I have 2 templates in my TreeListView. One for display and one for edit as shown below. When I select a node that is in display mode then use the keyboard and type a key, the "Name" value is updated with that key press. On key press, the edit template is loaded and the Name/Description fields are disabled. The IsEditableStatus field is not changed. This makes no sense and I don't know how to get around it. Thanks for your help.
The TreeListView:
<telerik:RadTreeListView x:Name="treeListView" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" CanUserFreezeColumns="False" CanUserReorderColumns="False" SelectionMode="Single" Grid.Row="1" Margin="5" IsReadOnly="{Binding IsReadOnly}" ItemsSource="{Binding Hierarchy, Mode=TwoWay}" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" IsExpandedBinding="{Binding IsExpanded, Mode=TwoWay}" AutoExpandItems="True" ShowGroupPanel="False" IsFilteringAllowed="False" ShowColumnHeaders="False"> <telerik:RadTreeListView.ChildTableDefinitions> <telerik:TreeListViewTableDefinition ItemsSource="{Binding Children}"/> </telerik:RadTreeListView.ChildTableDefinitions> <telerik:RadTreeListView.Columns> <telerik:GridViewDataColumn DataMemberBinding="{Binding Name, Mode=TwoWay}" CellTemplate="{StaticResource TreeNodeTemplate}" CellEditTemplate="{StaticResource TreeNodeEditTemplate}" IsReadOnly="False" Width="*"/> <telerik:GridViewComboBoxColumn x:Name="itemTypeColumn" Header="Item Type" DataMemberBinding="{Binding ItemTypeID, Mode=TwoWay}" DisplayMemberPath="Name" SelectedValueMemberPath="ID" SortMemberPath="Order" SortingState="Ascending" ItemsSource="{Binding TypeModel.Items, Mode=TwoWay}" IsReadOnly="True" Width="150"/> <telerik:GridViewDataColumn DataMemberBinding="{Binding IsActive, Mode=TwoWay}" Header="Include"/> </telerik:RadTreeListView.Columns> </telerik:RadTreeListView>
The templates:
<DataTemplate x:Key="TreeNodeTemplate"> <StackPanel Orientation="Horizontal"> <Image Source="{Binding Image, Mode=TwoWay}" ToolTip="{Binding Barcode, Mode=TwoWay}"/> <TextBlock Text="{Binding Name, Mode=TwoWay}" Margin="5" ToolTip="{Binding Description}"/> </StackPanel> </DataTemplate> <DataTemplate x:Key="TreeNodeEditTemplate"> <StackPanel Orientation="Horizontal"> <Image Source="{Binding Image, Mode=TwoWay}" VerticalAlignment="Top"/> <Grid Margin="5" Background="Cornsilk"> <Grid.ColumnDefinitions> <ColumnDefinition Width="125"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="26"/> <RowDefinition Height="26"/> <RowDefinition Height="26"/> <RowDefinition Height="26"/> </Grid.RowDefinitions> <Label Content="ID:" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Right" VerticalAlignment="Center"/> <TextBlock Grid.Column="1" Text="{Binding ID, Mode=TwoWay}"/> <Label Content="Name:" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center"/> <TextBox Grid.Column="1" Grid.Row="1" Text="{Binding Name, Mode=TwoWay}" IsEnabled="{Binding IsEditableStatus}"/> <Label Content="Description:" Grid.Column="0" Grid.Row="2" HorizontalAlignment="Right" VerticalAlignment="Center"/> <TextBox Grid.Column="1" Grid.Row="2" Text="{Binding Description, Mode=TwoWay}" IsEnabled="{Binding IsEditableStatus}"/> <Label Content="Barcode:" Grid.Column="0" Grid.Row="3" HorizontalAlignment="Right" VerticalAlignment="Center"/> <TextBox Grid.Column="1" Grid.Row="3" Text="{Binding Barcode, Mode=TwoWay}"/> </Grid> </StackPanel> </DataTemplate></UserControl.Resources>