テンプレートバインディングによるカスタムコントロールのバインディング値

StackOverflow https://stackoverflow.com/questions/5884141

質問

ControlTemplateセクションを使用して、カスタムコントロールaを作成しました。

<myOtherControl DataContext="{TemplateBinding ItemsSource}"/>, 

そして、myothercontrolには次のようなものがあります

<DataGrid ItemsSource={Binding VMDataProperty}/>

私の見解では、私は持っています:

<A ItemsSource="{Binding VMData}"/>

私の意見では、これはうまくいくはずですが、そうではありません。

何かご意見は?

編集:

 ViewModelData VMData = new ViewModelData() 
{
    List<Person> VMDataProperty {get; set;}
    string Name { get; set;}
    DateTime DateBuy { get; set;}
    ...
    }
役に立ちましたか?

解決

ItemsSourceの代わりに「A」のデータコンテキストを設定する必要があるように見えます。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top