Hello,
I'm trying your XamlGrid to substitute a Telerik one that goes under pressure with a lot of data and high frequency update. With no style it performs really well but now I need to test your under pressure with style selections.
The first thing I need to verify is that all the features I've under your competitor works fine here.
In my DTO I've got a field IdStatus that based on this value it colors the whole row of a color taken from DB.
Now consider the following Converter
public class StatusRowColorStyleSelectorBase : IValueConverter { protected Dictionary<int, SolidColorBrush> StatuStyles; public StatusRowColorStyleSelectorBase() { StatuStyles = new Dictionary<int, SolidColorBrush> { {(int) StatusTypeEnum.Inserted, CreateStyle("Transparent")}, {(int) StatusTypeEnum.Cancelled, CreateStyle("#ff4500")}, {(int) StatusTypeEnum.Validated, CreateStyle("#00bfff")}, {(int) StatusTypeEnum.Exported, CreateStyle("#90ee90")} }; } private static SolidColorBrush CreateStyle(string color) { var convertFromString = ColorConverter.ConvertFromString(color); if (convertFromString is Color c) { return new SolidColorBrush(c); } return new SolidColorBrush(Colors.Transparent); } public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is IStatus status) { return StatuStyles[status.IdStatus]; } return value; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } }
And I've seen a sample where you do
<igDP:XamDataGrid Name="xamDataGrid1" BindToSampleData="True"> <igDP:XamDataGrid.Resources> <Style TargetType="{x:Type igDP:DataRecordCellArea}"> <Style.Triggers> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path= Record.Cells[1].Value}" Value="Sales" > <Setter Property="Background" Value="Orange" /> </DataTrigger> </Style.Triggers> </Style> </igDP:XamDataGrid.Resources> </igDP:XamDataGrid>
In this code you check on Cell[1], what if the user reorders the column?
It's possible to pass to the converter the whole DataItem?
Hello Paolo,
Thank you for the update.
Yes you can have blink for xamDataGrid .To animate a updated row in a XamDataGrid you would have to use storyBoiard inside the DataTrigger.
Your code would be something like this:
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Record.DataItem, Converter={StaticResource IsNotNullToBooleanConverter}}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="Background.Color" FillBehavior="HoldEnd" Duration="0:0:18" >
<ColorAnimationUsingKeyFrames.KeyFrames>
<LinearColorKeyFrame Value="Red" KeyTime="0:0:0" />
<LinearColorKeyFrame Value="Orange" KeyTime="0:0:4" />
</ColorAnimationUsingKeyFrames.KeyFrames>
</ColorAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
</DataTrigger>
You can also go through this post other developer provided more information with a sample application .
https://es.infragistics.com/community/forums/f/ultimate-ui-for-wpf/48013/animate-row-in-xamdatagrid-based-on-datatrigger-odd-behaviour
Please let me know if you need more information.
That's fine , but what about the blink? as I mentioned on the ticket I need to perform a blink when a field of the row is updated
Thank you for posting to our forum.
In order to understand the scenario I followed the code you provided and created a sample of my own.Now for both the questions I have information as :
1)When user reorder the column Cells[1].Value would still be same.If can also give the column name instead of passing the index like this: Cells[department].Value
2)Yes you can pass the whole DataItem to the converter but in this case if any property changes in the grid this converter would not fire.
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path= Record.Cells[1].Value}" Value="Sales" > I noticed, In this line of code “RelativeSource={RelativeSource Self}, Path= Record” code is redundant , you could just directly bind it like this:
<DataTrigger Binding="{Binding Cells[department].Value}" Value="Sales" >
Instead of passing the whole DataItem I would recommend you to pass the DataItem’s CustomProperty like this:
<DataTrigger Binding="{Binding DataItem.CustomProperty, Converter={StaticResource someKeyThatPointsAtAConverter}}" Value="Sales" > <Setter Property="Background" Value="Red" /></DataTrigger>
I have also attached a sample application for your reference.
Please find the attached sample and let me know if you need further assistance.
DataTrigger.zip