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
55
xamdatagrid change cell value of bound column via a DataTrigger event.
posted

Hi Guys, 

 

    Its my first post to the WPF forum. I am stuck with cellvaluepresenter for conditionally formatting a particular cell. Here is my use case. 

 

1) I have bound my grid to my business objects which has a property lets say 'Flag' , PropA & PropB,   

2) I have 2 columns ColA & ColB, they are bound to properties  PropA & PropB,  when the underlying property Flag is set to true, I need ColA cell to flash its background to Red and  need to change the value of ColB to 'XXX'. (I am using a XamNumericEditor for both ColA & colB)

 

I can achieve the flashing via storyboard , but cannot figure out a way to change the value of a bound column when DataTrigger enter action is fired and in the exit action use the bound value again. 

Any help is appreciated. 

 

 

 

StoryBoard for ColA

 <igDP:Field Name="PropA" Label="ColA">

                            <igDP:Field.Settings>

                                <igDP:FieldSettings LabelTextAlignment="Center" EditorType="{x:Type igEditors:XamNumericEditor}">

                                     <igDP:FieldSettings.CellValuePresenterStyle>

                                        <Style TargetType="{x:Type igDP:CellValuePresenter}" BasedOn="{StaticResource ColAStyle}">

                                            <Style.Triggers>

                                                <DataTrigger Binding="{Binding DataItem.Flag}" Value="True">

                                                    <DataTrigger.EnterActions>

                                                        <BeginStoryboard  x:Name="blinkBeginFlag">

                                                            <Storyboard x:Name="BlinkFlag" AutoReverse="True" RepeatBehavior="Forever" Storyboard.TargetProperty="(Background).(SolidColorBrush.Color)">

                                                                <ColorAnimation To="Red" Duration="0:0:1" />

                                                           </Storyboard>

                                                        </BeginStoryboard>

                                                    </DataTrigger.EnterActions>

                                                    <DataTrigger.ExitActions>

                                                        <RemoveStoryboard BeginStoryboardName="blinkBeginFlag" />

                                                    </DataTrigger.ExitActions>

                                                </DataTrigger>

                                            </Style.Triggers>

                                        </Style>

                                    </igDP:FieldSettings.CellValuePresenterStyle>

                                   <igDP:FieldSettings.EditorStyle>

                                        <Style TargetType="{x:Type igEditors:XamNumericEditor}" BasedOn="{StaticResource {x:Type igEditors:XamNumericEditor}}">

                                            <Setter Property="Mask" Value="{}{double:-10.3}" />                                            

                                            <Setter Property="HorizontalContentAlignment" Value="Left"/>

                                        </Style>

                                    </igDP:FieldSettings.EditorStyle>

                                </igDP:FieldSettings>

                            </igDP:Field.Settings>

                        </igDP:Field>