Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
215
Heirarchical Binding to Parent Row (Silverlight, MVVM)
posted

Greetings!

I'm having a problem trying to bind a heirarchical column style to its parent row's DataContext in xaml.

My grid's datasource is a collection of ViewModels, each of which has a property MyProperty. I need to set a style on a border that is in a datatemplate inside of a TemplatedColumn in a ColumnLayout inside of the grid, according to that parent ViewModel.MyProperty value (with a converter of course). That's a lot of nesting!

Here is a sketch of my problem:

<ig:XamGrid ItemsSource="{Binding Path=ItemViewModels}">

...

    <ig:ColumnLayout>               <<<<<<child level in heirarchy

    ...

      <ig:TemplateColumn Key="SomeColumn">

        <ig:TemplateColumn.ItemTemplate>  

         <DataTemplate>            

            <Border BorderBrush="{Binding RowData Path=MyProperty, Converter={StaticResource MyPropertyToBrushConverter}}"> //This does not work obviously, since I'm posting!

     ... 

 

 

I'd appreciate any help you can give!