Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Pass DataContext Down Through Objects in XAML

$
0
0

Hello guys,

I am trying to write a custom control and my problem is that the column does not not receive DataContext and therefore cannot do the binding.

My custom control looks like this:

class customControl:ItemsControl
{
  public ColumnCollection Columns { get; set; }
  ..
  ...
  .....
}


And my XAML looks like this:

<customControl ItemsSource={Binding employees}><customcontrol.Columns><columnCollection><column name={Binding colName1}/></columnCollection></costumControl.Columns></customControl>

Now the problem is that the column does not receive DataContext and cannot bind to the colName1 property which is in DataContext.

How do i solve this? How to pass down the DataContext to objects inside other objects inside other objects?


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>