我正在努力解决一个问题。我有一个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属性名称
答案 0 :(得分:1)
redis_node
方法需要GetBindingExpression
:
DependencyProperty