This question is locked. New answers and comments are not allowed.
Hi,
I'm trying to set up a relatively simple tree view. It just so happens that I have two different data types as nodes in this tree view and that seems to cause some unexpected behaviour. In another thread, it was determined that the background border wouldn't disappear if we moved off the cell. In this thread, I note that the CellEditEnded event does not fire for child nodes. Below is an outline of a solution that reproduces the problem. Use the debugger to catch when CellEditEnded event fires. Several other events seem to only also work on parent nodes. How can I make these events fire for child nodes when they are also of a different type than the parent node?
Thank you
View:
Code Behind:
Model:
I'm trying to set up a relatively simple tree view. It just so happens that I have two different data types as nodes in this tree view and that seems to cause some unexpected behaviour. In another thread, it was determined that the background border wouldn't disappear if we moved off the cell. In this thread, I note that the CellEditEnded event does not fire for child nodes. Below is an outline of a solution that reproduces the problem. Use the debugger to catch when CellEditEnded event fires. Several other events seem to only also work on parent nodes. How can I make these events fire for child nodes when they are also of a different type than the parent node?
Thank you
View:
<
telerik:RadTreeListView
ItemsSource
=
"{Binding ParentItems}"
AutoGenerateColumns
=
"False"
ShowColumnHeaders
=
"False"
ShowGroupPanel
=
"False"
HorizontalGridLinesBrush
=
"{x:Null}"
RowIndicatorVisibility
=
"Collapsed"
AutoExpandItems
=
"True"
CellEditEnded
=
"RadTreeListView_CellEditEnded"
>
<
telerik:RadTreeListView.Columns
>
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Name}"
/>
</
telerik:RadTreeListView.Columns
>
<
telerik:RadTreeListView.ChildTableDefinitions
>
<
telerik:TreeListViewTableDefinition
ItemsSource
=
"{Binding Children}"
/>
</
telerik:RadTreeListView.ChildTableDefinitions
>
</
telerik:RadTreeListView
>
Code Behind:
public
MainPage()
{
InitializeComponent();
this
.DataContext =
new
Model();
}
private
void
RadTreeListView_CellEditEnded(
object
sender, Telerik.Windows.Controls.GridViewCellEditEndedEventArgs e)
{
// Insert breakpoint here
}
Model:
public
class
Model
{
public
RadObservableCollection<Parent> ParentItems {
get
;
private
set
; }
public
Model()
{
ParentItems =
new
RadObservableCollection<Parent>();
var parent1 =
new
Parent { Name =
"Parent1"
};
parent1.Children.AddRange(
new
Child[] {
new
Child(
"Child1"
),
new
Child(
"Child2"
),
new
Child(
"Child3"
) });
ParentItems.Add(parent1);
var parent2 =
new
Parent { Name =
"Parent2"
};
parent2.Children.AddRange(
new
Child[] {
new
Child(
"Child4"
),
new
Child(
"Child5"
) });
ParentItems.Add(parent2);
var parent3 =
new
Parent { Name =
"Parent3"
};
parent3.Children.AddRange(
new
Child[] {
new
Child(
"Child6"
) });
ParentItems.Add(parent3);
}
}
public
class
Parent
{
public
string
Name {
get
;
set
; }
public
RadObservableCollection<Child> Children {
get
;
private
set
; }
public
Parent()
{
Children =
new
RadObservableCollection<Child>();
}
}
public
class
Child
{
public
string
Name {
get
;
set
; }
public
Child(
string
name)
{
Name = name;
}
}