I am trying to create dependency properties that utilize the Nullubale(Of T) structure. When I set the property in XAML, I get parser exceptions.
For instance, I have a user control and I may or may not want to set its color. If I don't set its color, I want t auto-color it using a predefined color. This would be easy using the Nullable(Of T) structure because I could simply do a test on the property like so: Me.Color.HasValue. I've tried explicitly defining a type converter attribute on my properties to no avail. Any ideas?
Public Shared ReadOnly ColorProperty As DependencyProperty = DependencyProperty.Register("Color", GetType(Nullable(Of Color)), GetType(Series), Nothing)
<ComponentModel.TypeConverterAttribute(GetType(Nullable(Of Color)))> _
Public Property Color() As Nullable(Of Color)
Get
Return CType(GetValue(Series.ColorProperty), Nullable(Of Color))
End Get
Set(ByVal value As Nullable(Of Color))
SetValue(Series.ColorProperty, value)
End Set
End Property
Bill - Senior .NET Applications Developer
My Blog = Mostly DevelopersPlease remember to click “Mark as Answer” on the post that helps you.