如何在Wpf中获取代码背后的XamComboEditor的项目源属性

时间:2017-08-16 10:20:49

标签: wpf xaml

我正在努力解决一个问题。我有一个XamComboEditor,我想知道运行时代码背后的MVVM源属性。

<ig:XamComboEditor x:Name="Country"   EmptyText="Select ..." DisplayMemberPath="CountryName" SelectedValuePath="CountryCode" PreviewLostKeyboardFocus="Country_PreviewLostKeyboardFocus"
             ItemsSource="{Binding Path=DataCountry}" IsEnabled="{Binding IsEdit,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}"
             Grid.Row="0"  SelectedItem="{Binding SelectedCountry, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Grid.Column="1" Width="200" Height="40" />
var be = Country.GetBindingExpression(getComboBox.ItemsSource);
if (be != null && be.ParentBinding != null)
{
    sourceProperty = be.ParentBinding.Path.Path;
    if (sourceProperty.Contains('.'))
    {
        var spliteed = sourceProperty.Split('.');
        sourceProperty = spliteed[1];
    }
}

如何获取MVVM属性名称

1 个答案:

答案 0 :(得分:1)

redis_node方法需要GetBindingExpression

DependencyProperty