0
我正在努力解决一个问题。我有一个XamComboEditor
,我想在运行时的代码背后知道MVVM源代码。如何获取项目来源XamComboEditor的代码隐藏在Wpf中
<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属性名称
谢谢。大 –