【问题标题】:Getting a type of value from binding class without converter从没有转换器的绑定类中获取一种类型的值
【发布时间】:2012-04-06 00:52:45
【问题描述】:

我在从 Binding 类中获取值类型时遇到问题。

在我的情况下,我在RadPropertyGrid 上有一个AutoGeneratingPropertyDefinition 方法,此方法取决于绑定值的类型(我有这个Binding by e.PropertyDefinition.Binding)我需要设置一个DataTemplate。 但是因为我不知道它是布尔值、文本还是集合,我可以设置它(例如:对于布尔值,我需要一个带有复选框的数据模板)。

我怎样才能得到这个Type

【问题讨论】:

    标签: silverlight binding silverlight-4.0 telerik


    【解决方案1】:

    这对我有用:

    PropertyInfo propertyInfo= radPropertyGrid.Item.GetType().GetProperties().Where(p => p.Name == e.PropertyDefinition.DisplayName).FirstOrDefault();
    Type bindingPropertyType = propertyInfo.PropertyType;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-07
      • 2011-10-21
      • 1970-01-01
      • 1970-01-01
      • 2011-04-13
      • 2018-02-15
      相关资源
      最近更新 更多