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
430
XamGrid: DataContext of an unbound column
posted

Hello,

I'm having a little issue with unbound columns. When defining a DataTemplate for the cell in an unbound column, the ContentPresenter for some unknown reason has the DataContext property set to some TextBlock.

All the other components of the cell style has the expected UnboundColumnDataContext.

The markup is as follows:

<Style TargetType="{x:Type ig:CellControl}" x:Key="ActionsColumnStyle">
    <Setter Property="ContentTemplate">
        <Setter.Value>
            <DataTemplate>
<TextBlock Text="Test" />
</DataTemplate>
</Setter.Value>
</Setter>
</Style>

Parents
No Data
Reply
  • 17559
    posted

    Hello,

     

    I succeed in reproducing the issue that you are referring and I am going to forward this to our engineering team. Still if you want the TextBlock from your DataTemplate to inherit the UnboundColumnDataContext for now you can just set the following binding to it:

     

    DataContext="{Binding RelativeSource={RelativeSource AncestorType={x:Type igPrim:CellsPanel}}, Path=DataContext}"

     

    Please let me know if you have any additional concerns on this matter.

Children