以下列出可能會使用到的項目:
可以在 class 上加入 Description, 來說明物件的功用 (上圖)
[Description("可點選物件 - 可以設定為正確或錯誤點選")] public class ClickItemProcess : QuestionGroupBase<panel> { //.. }
Description 也可以使用在 property 上, 並能以 Category 來分類 (上圖)
[Category("遊戲功能"), Description("若此物件為錯誤答案,點選後所顯示的動畫(Storyboard)")] public string WrongAnswerAnimation { get { return (string)GetValue(WrongAnswerAnimationProperty); } set { SetValue(WrongAnswerAnimationProperty, value); } }
如果 property 不希望出現在 Expression Blend 的面板上, 可以將 Browsable 設為 false
Result m_Result = Result.NoAnswer; [Browsable(false)] public Result Result { get { return m_Result; } set { m_Result = value; } }
如果 properties 屬於 state, element 或 storyboard, 並希望直接出現下拉選單,則可以用 CustomPropertyValueEditorAttribute 來設定。CustomPropertyValueEditor.StateName, CustomPropertyValueEditor.Element, CustomPropertyValueEditor.Storyboard 分別對應這三種不同類型的物件。
[CustomPropertyValueEditorAttribute(CustomPropertyValueEditor.Storyboard)] public Storyboard RightAnswerAnimation { get { return (Storyboard)GetValue(RightAnswerAnimationProperty); } set { SetValue(RightAnswerAnimationProperty, value); } }
另外,對於 TriggerAction, 可以利用 DefaultTriggerAttribute 預設 event。以及利用 TypeConstraintAttribute 來限制 TargetedTriggerAction 與 EventTriggerBase 的 AssociatedObject 型態。
[DefaultTrigger(typeof(UIElement), typeof(EventTrigger), "MouseLeftButtonDown")] [DefaultTrigger(typeof(ButtonBase), typeof(EventTrigger), "Click")] public class WaveAction : TriggerAction<UIElement> { }
[reference]
MSDN: Design-Time Attributes for Components
State, Element, and Storyboard Pickers
Silverlight Hover Behavior
1 則留言:
I've read a few just right stuff here. Definitely value bookmarking for revisiting. I wonder how a lot effort you put to create one of these excellent informative web site.
my page: windows registry cleaner
張貼留言