Symbol in RowHeader depending on data in row

Posted by: sascha.hennig on 11 September 2018, 1:30 am EST

  • Posted 11 September 2018, 1:30 am EST

    Hi.

    I am setting a DataTable a data source for a worksheet and now I want to show an icon or an vector graphic object in the row header, depending on the data contained in each row. I have modified the style for RowHeaderCellPresenter like this

    <Style TargetType="ss:RowHeaderCellPresenter">
    <Setter Property="Background" Value="Transparent"/>
    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    <Setter Property="VerticalContentAlignment" Value="Stretch" />
    <Setter Property="IsTabStop" Value="False" />
    <Setter Property="Template">
    <Setter.Value>
    <ControlTemplate TargetType="ss:RowHeaderCellPresenter">
    <Border
    Width="16"
    Height="16"
    Margin="4,-2,0,0"
    VerticalAlignment="Center"
    controls:VectorGraphic.Foreground="CornflowerBlue"
    Child="{StaticResource VectorIconDelete}"
    ToolTip="test tooltip"
    ToolTipService.ShowDuration="6000000" >
    </Border>
    </ControlTemplate>
    </Setter.Value>
    </Setter>
    </Style>

    The result is like this


    Now, i have to place a trigger or something like that. But I have no clue how to get access to the data of each row, to set a different vector graphic depending on the rows data. Any ideas or other approaches?

    Best regards,

    Sascha
  • Marked as Answer

    Replied 12 September 2018, 10:32 pm EST

    Hi Sascha,

    You would need to get the icon object with VisualTreeHelper and capture it's click event.


    Thanks,
    Deepak Sharma
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels