Search code examples
wpftelerikradgridview

radgridview access column in the same level


Hi I want to apply a style names "DataColumnStyle" on a column "colA" in my radgridview if an other column "colB" is invisble but I didn't find how to acces to the visibility of "colB".

<Style x:Key="DataColumnStyle"
           TargetType="telerik:GridViewCell">
        <Setter Property="ToolTip"
                Value="{Binding BienEtService.PolitiquePrixBes.PrixVenteTTC,
                                Mode=OneWay,
                                StringFormat='{}{0:0.00 €}'}" />
        <Style.Triggers>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding RelativeSource={RelativeSource Self},
                                                 Path=IsVisible}"
                               Value="True" />
                </MultiDataTrigger.Conditions>
                <Setter Property="Foreground"
                        Value="Orange" />
            </MultiDataTrigger>
        </Style.Triggers>
    </Style>

Solution

  • You should be able to bind to the column if you know its index within the Columns collection of the parent RadGridView:

    <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=telerik:RadGridView}, Path=Columns[0].IsVisible}" Value="True" />
    

    You can't bind to it by name though.