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
300
BorderBrush Cell conditionnal
posted

Hi,

 I begin with XamDataGrid, and i do some fonctionnality easy.

But now i would like one think, i think easy but no.

i would like to change the border coler of cell when the Tag of cell content "comment".

i write this:

<Style TargetType="{x:Type igDP:CellValuePresenter}" x:Key="BorderComment">

<Style.Triggers>

<DataTrigger Binding="{Binding Path=Cell.Tag.ToString()}" Value="comment">

<Setter Property="BorderBrush" Value="Red"/>

<Setter Property="BorderThickness" Value="1,1,1,1"></Setter>

</DataTrigger>

</Style.Triggers>

</Style>

but it don't work.

i need some help,

thank for all

Nathalie

Parents
No Data
Reply
  • 6867
    Verified Answer
    posted

    Hi,

    Your trigger's binding is off.  The DataContext of a CellValuePresenter is the associated DataRecord, and you can't call ToString() in a binding expression.  Here's the right way to do it...

    <Style TargetType="{x:Type igDP:CellValuePresenter}">
      <Style.Triggers>
        <DataTrigger Binding="{Binding Path=Cells[SomeFieldName].Tag}" Value="comment">
          <Setter Property="BorderBrush" Value="Red"/>
          <Setter Property="BorderThickness" Value="1" />
        </DataTrigger>
      </Style.Triggers>
    </Style>

    Josh

Children