This is a migrated thread and some comments may be shown as answers.

Editor problem

2 Answers 67 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tal
Top achievements
Rank 1
Tal asked on 19 Feb 2009, 04:38 PM
Hi,
I have created grid with the following column style
<Telerik:GridViewDataColumn HeaderText="Comment" IsFilterable="False" UniqueName="Comment" DataMemberPath="InnerValue" Width="*"
                    <Telerik:GridViewDataColumn.CellStyle> 
                        <Style TargetType="{x:Type Telerik:GridViewCell}"
                            <EventSetter Event="EditEnded" Handler="Comment_EditEnded"/> 
                            <EventSetter Event="MouseUp" Handler="Cell_MouseUp" /> 
                            <Setter Property="IsEnabled" Value="{Binding Path=IsSelected}"/> 
                            <Setter Property="Template"
                                <Setter.Value> 
                                    <ControlTemplate TargetType="{x:Type Telerik:GridViewCell}"
                                        <ctlPanel:ColumnWrapPanel> 
                                            <TextBlock TextWrapping="Wrap" TextTrimming="None" Text="{TemplateBinding Content}"/> 
                                        </ctlPanel:ColumnWrapPanel> 
                                    </ControlTemplate> 
                                </Setter.Value> 
                            </Setter> 
                            <Style.Triggers> 
                                <Trigger Property="IsInEditMode" Value="True"
                                    <Setter Property="Template"
                                        <Setter.Value> 
                                            <ControlTemplate TargetType="{x:Type Telerik:GridViewCell}"
                                                <ctlPanel:ColumnWrapPanel> 
                                                    <TextBox Name="txt" Height="auto" TextWrapping="Wrap" Margin="2,2,2,2"  Foreground="Black" 
                                                            Text="{TemplateBinding Content}"/> 
                                                </ctlPanel:ColumnWrapPanel> 
                                            </ControlTemplate> 
                                        </Setter.Value> 
                                    </Setter> 
                                </Trigger> 
                            </Style.Triggers> 
                        </Style> 
                    </Telerik:GridViewDataColumn.CellStyle> 
                </Telerik:GridViewDataColumn> 

when i finish editing, the e.NewValue in Comment_EditEnded event still shows the old value..am I missing something?
Thanks,
Tal

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 23 Feb 2009, 07:16 AM
Hello Tal,

You may need to use two way binding for the real object property - not for the cell Content property.

Sincerely yours,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Tal
Top achievements
Rank 1
answered on 23 Feb 2009, 12:32 PM
Well I performed the following change:

<Setter Property="Template"
                                <Setter.Value> 
                                    <ControlTemplate TargetType="{x:Type Telerik:GridViewCell}"
                                        <ctlPanel:ColumnWrapPanel> 
                                           <ContentPresenter/> 
                                        </ctlPanel:ColumnWrapPanel> 
                                    </ControlTemplate> 
                                </Setter.Value> 
                            </Setter> 
                            <Style.Triggers> 
                                <Trigger Property="IsInEditMode" Value="True"
                                    <Setter Property="Template"
                                        <Setter.Value> 
                                            <ControlTemplate TargetType="{x:Type Telerik:GridViewCell}"
                                                <ctlPanel:ColumnWrapPanel> 
                                                    <TextBox Name="txt" Height="auto" TextWrapping="Wrap" Margin="2,2,2,2"  Foreground="Black"  
                                                        Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=DataContext.InnerValue, UpdateSourceTrigger=PropertyChanged}"/> 
                                                </ctlPanel:ColumnWrapPanel> 
                                            </ControlTemplate> 
                                        </Setter.Value> 
                                    </Setter> 
                                </Trigger> 
                            </Style.Triggers> 

and it works, but for some reason in the EditEnded event the OldValue in the arguments is actually my new value and the NewValue is the old value.




Tags
GridView
Asked by
Tal
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Tal
Top achievements
Rank 1
Share this question
or