Question

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;}
    ...
    }
Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top