DataTrigger on DataGridTextColumn
I am trying to attach a datatrigger on one of my combobox element. The trigger should read the attached property of the DataGridTextColumn (combobox's ancestor) and take decision based on that. Now the problem is that the DataGridTextColumn isn't part of Visual Tree so I cannot get it by RelativeSource Ancestor. Here is sample code.


    <ComboBox Name="cmbFilter" DisplayMemberPath="CategoryName">
        <ComboBox.Style>
            <Style>
                <Style.Triggers>
                   <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type DataGridTextColumn}}, 
                                 Path=Header}"
                                 Value="Id">
                        <Setter Property="Control.Visibility" Value="Collapsed"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </ComboBox.Style>
    </ComboBox>

Any one maybe suggest some alternative

regards,
Nirvan.


DataTrigger on DataGridTextColumn
===

I am trying to attach a datatrigger on one of my combobox element. The trigger should read the attached property of the DataGridTextColumn (combobox's ancestor) and take decision based on that. Now the problem is that the DataGridTextColumn isn't part of Visual Tree so I cannot get it by RelativeSource Ancestor. Here is sample code.


    <ComboBox Name="cmbFilter" DisplayMemberPath="CategoryName">
        <ComboBox.Style>
            <Style>
                <Style.Triggers>
                   <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type DataGridTextColumn}}, 
                                 Path=Header}"
                                 Value="Id">
                        <Setter Property="Control.Visibility" Value="Collapsed"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </ComboBox.Style>
    </ComboBox>

Any one maybe suggest some alternative

regards,
Nirvan.

