Expression >
Forums Home
>
Expression Studio Forums
>
Expression Blend + SketchFlow
>
Why is my custom property not shown?
Why is my custom property not shown?
- I'm building a custom Window and I'm now working on the Titlebar buttons, and have added this property:
Public Shared AllowMinimizeProperty As DependencyProperty Public Property AllowMinimize() As Boolean Get Return CBool(GetValue(AllowMinimizeProperty)) End Get Set(ByVal value As Boolean) SetValue(AllowMinimizeProperty, value) Dim img As Image = GetTemplateChild("imgMinimize") If img IsNot Nothing Then img.Opacity = IIf(value, 1.0, 0.5) End If End Set End Property Public Sub New() AllowMinimizeProperty = DependencyProperty.Register("AllowMinimize", GetType(System.Boolean), GetType(BaseWindow), New UIPropertyMetadata(True)) End Sub
Now whenever I load up Blend, this property does not show up in the Miscellaneous section. If I change this property to NOT be a DependencyProperty, it will show, BUT it simple won't work. The image won't change it's opacity.What am I doing wrong?
Answers
- Hi assassin316,
because when editing your Window in Blend the constructor of the root element (Window) is not called. Only the constructors of child elements are called. So your property is never registered.
Try it out raise an execption in New() and edit the window in Blend.
Hope it helps.- Marked As Answer byassassin316 Sunday, November 08, 2009 2:37 PM
- Try to register it directly?
Public Shared AllowMinimizeProperty As DependencyProperty = DependencyProperty.Register("AllowMinimize", GetType(System.Boolean), GetType(BaseWindow), New UIPropertyMetadata(True))
Hope that helps.- Marked As Answer byassassin316 Saturday, November 14, 2009 9:06 PM
All Replies
- Hi assassin316,
because when editing your Window in Blend the constructor of the root element (Window) is not called. Only the constructors of child elements are called. So your property is never registered.
Try it out raise an execption in New() and edit the window in Blend.
Hope it helps.- Marked As Answer byassassin316 Sunday, November 08, 2009 2:37 PM
- That is an interesting piece of info, thanks Guenter ! :)Coming back to this problem, how then can I go ahead and have my property show in Blend ???
- Sorry, I need to bump this message to find a solution :\
- Try to register it directly?
Public Shared AllowMinimizeProperty As DependencyProperty = DependencyProperty.Register("AllowMinimize", GetType(System.Boolean), GetType(BaseWindow), New UIPropertyMetadata(True))
Hope that helps.- Marked As Answer byassassin316 Saturday, November 14, 2009 9:06 PM
- Perfect, i'll try that!Thanks again!
- I'm learning about properties as well... just wondering if this solution worked for you? If so, can you please mark it so us newbies know if it worked. :) Thanks!
- Yes, it worked perfectly :) Just register the property on it's declaration, I've marked the answer above (answered by Guenter).

