I have created a custom control A, with ControlTemplate section, where:

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

and MyOtherControl has:

<DataGrid ItemsSource={Binding VMDataProperty}/>

In my view I have:

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

By my opinion this should work, but it doesn't;

Any thoughts?

Edit:

 ViewModelData VMData = new ViewModelData() 
{
    List<Person> VMDataProperty {get; set;}
    string Name { get; set;}
    DateTime DateBuy { get; set;}
    ...
    }
有帮助吗?

解决方案

It looks to me like you should be setting the DataContext of "A" instead of its ItemsSource.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top