.net DependencyPropertyDescriptor.FromProperty doens';在Net4.0中不再工作
我正在迁移一些自己构建的“框架”dll,我遇到了意想不到的行为。我将问题归结为以下几点: 我有一个带有依赖属性的自定义组合框.net DependencyPropertyDescriptor.FromProperty doens';在Net4.0中不再工作,.net,wpf,vb.net,dependencies,propertydescriptor,.net,Wpf,Vb.net,Dependencies,Propertydescriptor,我正在迁移一些自己构建的“框架”dll,我遇到了意想不到的行为。我将问题归结为以下几点: 我有一个带有依赖属性的自定义组合框 Public Class MyCombobox Inherits ComboBox Public Property MyString As String Get Return CInt(GetValue(MyStringProperty)) End Get Set(ByVal value As String) S
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
当我调用此代码时:
Dim descriptor As DependencyPropertyDescriptor = DependencyPropertyDescriptor.FromProperty(MyCombobox.MyStringProperty, New MyCombobox().GetType())
这是回报
在.NET 3.5->有效的PropertyDescriptor中
在.NET4.0中->Nothing,Niente,Nada,Null
这是.NET framework中的错误吗?它被弃用了吗?是否有其他选项可以访问描述符?如果可能,请不要使用DependencyPropertyDescriptor。请不要忘记,这是遗留代码。我需要把它换成现金