Howdy,
I have alternate row colors and conditional row colors, colors based on a numeric value in a column.
However, now I have to add blinking to a row based on a bool value in column.
Any hints?
Thanks
Oskar
<igWPF:XamDataGrid.Resources> <Style TargetType="{x:Type igWPF:DataRecordCellArea}"> <Setter Property="Background"> <Setter.Value> <SolidColorBrush Color="{Binding Path=Cells[Alarmlevel].Value, Converter={StaticResource alarmColorConverter}}"> </SolidColorBrush> </Setter.Value> </Setter> <Setter Property="BackgroundAlternate"> <Setter.Value> <SolidColorBrush Color="{Binding Path=Cells[Alarmlevel].Value, Converter={StaticResource alarmColorLowConverter}}"> </SolidColorBrush> </Setter.Value> </Setter> </Style>
Excuse me,
is there a way I can only make it blink one, then revert the boolean property to false?
I mean I'm in a similar situation, I need to refresh just one time to tell the user that the row has been updated, sp I've a property in my model that's HasChanged, it's set to true when the DataItem is updated then it should be reverted to false after it has blinked
Hello Oskar,
In order to animate a row in the XamDataGrid based on a bool value in another column, I would recommend continuing with the idea of a Style for DataRecordCellArea, and utilize a DataTrigger with it. For example, you could continue binding to the Cells collection, and you could also bind to the underlying DataItem property to access your underlying type.
The DataTrigger class has EnterActions and ExitActions, and I would recommend that you utilize a BeginStoryboard element pointed at a Storyboard with a ColorAnimation pointed at <BackgroundPropertyName>.Color. This DataTrigger could look like the following:
<DataTrigger Binding="{Binding DataItem.Animate}" Value="True"> <DataTrigger.EnterActions> <BeginStoryboard Storyboard="{StaticResource animateStory}" Name="beginStory"/> </DataTrigger.EnterActions> <DataTrigger.ExitActions> <StopStoryboard BeginStoryboardName="beginStory" /> </DataTrigger.ExitActions></DataTrigger>
In this case, the "animateStory" Storyboard could look like the following:
<Storyboard x:Key="animateStory"> <ColorAnimation Duration="0:0:1" To="Red" RepeatBehavior="Forever" AutoReverse="True" Storyboard.TargetProperty="Background.Color"/></Storyboard>
I have attached a sample project to demonstrate the above. I hope this helps.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate Developer