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
350
XamGrid Row background color
posted

Hello,

I'm tryng to set background color of row on my Xamgrid.

I make something like this : 

<UserControl.Resources>
<Style TargetType="{x:Type ig:CellControl}">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Cell.Row.CommandeFournisseur.Numero}" Value="IC/140029">
<Setter Property="Background" Value="Red"/>
</DataTrigger>
</Style.Triggers>
</Style>
</UserControl.Resources>

But when the value is IC/140029 nothing append...

My xamgrid is like this :

<ig:XamGrid x:Name="dataGrid"
AutoGenerateColumns="False"
ColumnWidth="auto"
FontSize="10"
FontFamily="Calibri"
Foreground="Black"
Grid.Column="0"
Grid.Row="1"
Grid.ColumnSpan="2"
RowHover="Row"
RowHeight="20"
Margin="5"
ItemsSource="{Binding ListeAfterFiltre}">

ListeAfterFiltre is type of ObservableCollection<CommandeFournisseur>


thanks

Parents
  • 22015
    posted

    Hello EASii IC,

     

    Thank you for your post!

     

    I have been looking into it and have created a small sample application for you. In it I have a simple XamGrid bind to a collection. In the collection I have a property UniqueID of type string, which has value - IC/140029.

    I have used the style you have provided for the CellControl. Then I have changed the binding for the DataTrigger to

    Binding="{Binding RelativeSource={RelativeSource Self}, Path=DataContext.UniqueID}".

     

    Please find the attached sample application and feel free to let me know if you have any further questions on this matter.

    Grid_BackrgoudColorDataTrigger.zip
Reply Children