2017-08-16 20 views
0

私は1つの問題で苦労しています。私はXamComboEditorを持っており、これは実行時のコードの中でこれのMVVMソースプロパティを知りたい。 Wpfのコードの中のXamComboEditorのアイテムソースを取得する方法


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]; 
    } 
} 

<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" /> 

はMVVM物件名

答えて

1

を取得するにはどのようGetBindingExpression方法はDependencyProperty見込ん:

var be = Country.GetBindingExpression(XamComboEditor.ItemsSourceProperty); 
if (be != null && be.ParentBinding != null) 
... 
+0

はありがとうございます。すばらしいです –

関連する問題