DependencyPropertyDescriptor.FromProperty no longer works in NET 4.0

I am porting some native 'framework' DLL and I am experiencing undefined behavior. I split the problem into the following:

I have a custom combobox with a dependency property

Public Class MyCombobox
Inherits ComboBox

Public Property MyString As String
    Get
        Return CInt(GetValue(MyStringProperty))
    End Get

    Set(ByVal value As String)
        SetValue(MyStringProperty, value)
    End Set
End Property

Public Shared ReadOnly MyStringProperty As DependencyProperty = DependencyProperty.Register("MyString", GetType(String), GetType(MyCombobox), New FrameworkPropertyMetadata())

End Class

      

When I call this code:

Dim descriptor As DependencyPropertyDescriptor = DependencyPropertyDescriptor.FromProperty(MyCombobox.MyStringProperty, New MyCombobox().GetType())

      

This returns

In .NET 3.5 -> Valid PropertyDescriptor

In .NET 4.0 -> Nothing, Niente, Nada, Null

Is this a bug in the .NET Framework? Is it out of date? Do I have any other options for accessing the descriptor?

+3


source to share





All Articles