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
240
Data Trigger Problem
posted

My XamDataGrid has 3 fields(No, Action, ActionInfo). WhenInfo field has 5byte data. so, the data means time(HH:mm) or datetime(yy/MM/dd HH:mm) or custom data.

so, i am using datatrigger.

                <Style x:Key="ActionInfoCellValueEditorStyle" TargetType="{x:Type igEditors:XamTextEditor}">
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Path=Cells[Action].Value}" Value="255">
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type igEditors:XamTextEditor}">
                                        <StackPanel>
                                            <TextBlock Text="{Binding Converter={StaticResource nonDataConverter},
                                                RelativeSource={RelativeSource TemplatedParent}, Path=Value, Mode=TwoWay,
                                                UpdateSourceTrigger=PropertyChanged}"
                                                VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                        </StackPanel>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>

                            <Setter Property="EditTemplate"  >
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type igEditors:XamTextEditor}">
                                        <StackPanel>
                                            <TextBlock Text="None"/>
                                        </StackPanel>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </DataTrigger>

                        <DataTrigger Binding="{Binding Path=Cells[Action].Value}" Value="0">
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type igEditors:XamTextEditor}">
                                        <StackPanel>
                                            <TextBlock Text="{Binding Converter={StaticResource partitionConverter},
                                                RelativeSource={RelativeSource TemplatedParent}, Path=Value, Mode=TwoWay}"
                                                VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                        </StackPanel>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>

                            <Setter Property="EditTemplate">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type igEditors:XamTextEditor}">
                                        <Grid>
                                            <ComboBox Grid.Column="0" ItemsSource="{Binding Source={StaticResource odpPartitionList}}"
                                                    IsSynchronizedWithCurrentItem="True"
                                                  DisplayMemberPath="Text"
                                                  SelectedValuePath="Value"
                                                  SelectedValue="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Value.[0], Mode=TwoWay,
                                                  UpdateSourceTrigger=PropertyChanged}"/>
                                        </Grid>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </DataTrigger>

                        <DataTrigger Binding="{Binding Path=Cells[Action].Value}" Value="1">
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type igEditors:XamTextEditor}">
                                        <StackPanel>
                                            <TextBlock Text="{Binding Converter={StaticResource partitionConverter},
                                                RelativeSource={RelativeSource TemplatedParent}, Path=Value, Mode=TwoWay}"
                                                VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                        </StackPanel>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>

                            <Setter Property="EditTemplate">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type igEditors:XamTextEditor}">
                                        <Grid>
                                            <ComboBox Grid.Column="0" ItemsSource="{Binding Source={StaticResource odpPartitionList}}"
                                                      DisplayMemberPath="Text"
                                                      SelectedValuePath="Value"
                                                      SelectedValue="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Value.[0], Mode=TwoWay,
                                                  UpdateSourceTrigger=PropertyChanged}"/>
                                        </Grid>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </DataTrigger>

 

........................................................

            <igDP:XamDataGrid.FieldLayouts>
                <igDP:FieldLayout>
                    <igDP:FieldLayout.Fields>
                        <igDP:Field Name="No" Label="No" IsScrollTipField="True">
                            <igDP:Field.Settings>
                                <igDP:FieldSettings
                                    AllowResize="False"  LabelWidth="50" LabelMaxWidth="50" CellWidth="50" CellMaxWidth="50" AllowEdit="False"/>
                            </igDP:Field.Settings>
                        </igDP:Field>


                        <igDP:Field Name="Action" Label="Action">
                            <igDP:Field.Settings>
                                <igDP:FieldSettings EditorStyle="{StaticResource scheduleActionComboBoxEditor}"/>
                            </igDP:Field.Settings>
                        </igDP:Field>
                        <igDP:Field Name="ActionInfo" Label="Information" IsExpandable="False">
                            <igDP:Field.Settings>
                                <igDP:FieldSettings EditorStyle="{StaticResource ActionInfoCellValueEditorStyle}" EditorType="{x:Type igEditors:XamTextEditor}"/>
                            </igDP:Field.Settings>
                        </igDP:Field>
                    </igDP:FieldLayout.Fields>

 

 

however, my code has a problem. first time, when i edit Action field, ActionInfo is displayed by data trigger. but, when i edit Action field after i edit ActionInfo field, ActionInfo filed is displayed by old data. but, after XamDataGrid was redraw by grouping, ActionInfo field is displayed by new data.

 

How can i modify my code??