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,
It will automatically revert back to false when you are done editing the item.
I have created a sample application for your reference. Find the attached sample and let me know if you need further assistance.
WpfApplication2.zip
back to False I mean
Ok but how do I revert the IsDataChanged to back when it's passed the storyboard?
Thank you for the update.
In my previous approach the Storyboard being applied to the trigger in which I am checking if the IsNotNullToBooleanConverter is true ie for each newly added records.
If you wants to apply the same story board to the updated item, you just need to change the trigger to check if the IsDataChanged is changed. The approach would be same it just you need to change the condition.
Something like this :
<DataTrigger Binding="{Binding IsDataChanged}" Value="True">
Please let me know if you need further assistance.
I've tried your approach but it only works when the row is loaded, not at the update of the item, you can check in the mockup I'm working on
Thanks
HighFreqUpdate.zip