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
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.
It's ok with the color but i have a problem with column's height.
The column modif and pdf have a height problem.
My buttons are cut.
My table options are :
<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}" >
My buttons are set like this :
<ig:UnboundColumn Key="Modif" HeaderText="Modif" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Width="50"><ig:UnboundColumn.ItemTemplate><DataTemplate><Button Style="{StaticResource EditButtonStyle}"Height="18" Command="{Binding DataContext.AfficherDetailCommand,RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ig:XamGrid}}}" CommandParameter="{Binding RowData}"></Button></DataTemplate></ig:UnboundColumn.ItemTemplate></ig:UnboundColumn>
<ig:UnboundColumn Key="PDFFR" HeaderText="PDF FR" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" IsGroupable="False" IsFilterable="False" IsResizable="False"><ig:UnboundColumn.ItemTemplate><DataTemplate><Button Style="{StaticResource FlatIconeButton}" BorderBrush="White" Background="White" Name="FR"Command="{Binding DataContext.AfficherPDFCommandFR,RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ig:XamGrid}}}" CommandParameter="{Binding RowData}"Height="20" Width="20"ToolTip="Afficher le PDF"><ContentControl Style="{StaticResource ERP_PDF_ContentControlStyle}" BorderBrush="Black"/></Button></DataTemplate></ig:UnboundColumn.ItemTemplate></ig:UnboundColumn>
Look at picture