Hi
I have simple TreeListView like this:
01.
<
telerik:RadTreeListView
x:Name
=
"radtreelistviewGUIObjects"
RowIsExpandedChanging
=
"radtreelistviewGUIObjects_RowIsExpandedChanging"
RowIsExpandedChanged
=
"radtreelistviewGUIObjects_RowIsExpandedChanged"
RowLoaded
=
"radtreelistviewGUIObjects_RowLoaded"
AutoGenerateColumns
=
"False"
Tag
=
"3184"
>
02.
<
telerikGrid:RadTreeListView.ChildTableDefinitions
>
03.
<
telerikGrid:TreeListViewTableDefinition
ItemsSource
=
"{Binding Items}"
/>
04.
</
telerikGrid:RadTreeListView.ChildTableDefinitions
>
05.
<
telerikGrid:RadTreeListView.Columns
>
06.
<
telerikGrid:GridViewDataColumn
DataMemberBinding
=
"{Binding Name}"
Header
=
"Element"
MinWidth
=
"300"
/>
07.
<
telerikGrid:GridViewDataColumn
Header
=
"Widoczny"
CellTemplate
=
"{StaticResource VisibleProperty}"
/>
08.
<
telerikGrid:GridViewDataColumn
Header
=
"Aktywny"
CellTemplate
=
"{StaticResource EnableProperty}"
/>
09.
<
telerikGrid:GridViewDataColumn
Header
=
"Tylko do odczytu"
CellTemplate
=
"{StaticResource ReadOnlyProperty}"
/>
10.
<
telerikGrid:GridViewDataColumn
Header
=
"Wersja"
CellTemplate
=
"{StaticResource VersionProperty}"
/>
11.
</
telerikGrid:RadTreeListView.Columns
>
12.
</
telerik:RadTreeListView
>
and these templates:
01.
<
telerik:HierarchicalDataTemplate
x:Key
=
"RadItem"
>
02.
<
TextBlock
Text
=
"{Binding Name}"
VerticalAlignment
=
"Center"
/>
03.
</
telerik:HierarchicalDataTemplate
>
04.
<
telerik:HierarchicalDataTemplate
x:Key
=
"VisibleProperty"
>
05.
<
CheckBox
IsChecked
=
"{Binding Visible, Mode=TwoWay}"
Checked
=
"VisibleCheckBox_Checked"
Unchecked
=
"VisibleCheckBox_Checked"
HorizontalAlignment
=
"Center"
/>
06.
</
telerik:HierarchicalDataTemplate
>
07.
<
telerik:HierarchicalDataTemplate
x:Key
=
"EnableProperty"
>
08.
<
CheckBox
IsChecked
=
"{Binding Enable, Mode=TwoWay}"
Checked
=
"EnableCheckBox_Checked"
Unchecked
=
"EnableCheckBox_Checked"
HorizontalAlignment
=
"Center"
/>
09.
</
telerik:HierarchicalDataTemplate
>
10.
<
telerik:HierarchicalDataTemplate
x:Key
=
"ReadOnlyProperty"
>
11.
<
CheckBox
IsChecked
=
"{Binding ReadOnly, Mode=TwoWay}"
Checked
=
"ReadOnlyCheckBox_Checked"
Unchecked
=
"ReadOnlyCheckBox_Checked"
HorizontalAlignment
=
"Center"
/>
12.
</
telerik:HierarchicalDataTemplate
>
13.
<
telerik:HierarchicalDataTemplate
x:Key
=
"VersionProperty"
>
14.
<
TextBlock
Text
=
"{Binding Version}"
VerticalAlignment
=
"Center"
HorizontalAlignment
=
"Center"
/>
15.
</
telerik:HierarchicalDataTemplate
>
initializes this list in my source code:
01.
ObservableCollection<
TreeRulesItem
> ElementsTree = new ObservableCollection<
TreeRulesItem
>();
02.
03.
TreeRulesItem rulesItem = new TreeRulesItem();
04.
rulesItem.ID = 1;
05.
rulesItem.Name = "a";
06.
rulesItem.Version = 1;
07.
rulesItem.Visible = true;
08.
rulesItem.Enable = true;
09.
rulesItem.ReadOnly = true;
10.
11.
this.ElementsTree.Add(rulesItem);
12.
13.
reeRulesItem childrulesItem = new TreeRulesItem();
14.
childrulesItem.ID = 2;
15.
childrulesItem.Name = "b";
16.
childrulesItem.Version = 1;
17.
childrulesItem.Visible = true;
18.
childrulesItem.Enable = true;
19.
childrulesItem.ReadOnly = true;
20.
rulesItem.Items.Add(childrulesItem);
21.
22.
TreeRulesItem childrulesItem2 = new TreeRulesItem();
23.
childrulesItem2.ID = 7;
24.
childrulesItem2.Name = "e";
25.
childrulesItem2.Version = 1;
26.
childrulesItem2.Visible = true;
27.
childrulesItem2.Enable = true;
28.
childrulesItem2.ReadOnly = true;
29.
childrulesItem.Items.Add(childrulesItem2);
30.
31.
childrulesItem2 = new TreeRulesItem();
32.
childrulesItem2.ID = 8;
33.
childrulesItem2.Name = "f";
34.
childrulesItem2.Version = 1;
35.
childrulesItem2.Visible = true;
36.
childrulesItem2.Enable = true;
37.
childrulesItem2.ReadOnly = true;
38.
childrulesItem.Items.Add(childrulesItem2);
39.
40.
childrulesItem = new TreeRulesItem();
41.
childrulesItem.ID = 3;
42.
childrulesItem.Name = "c";
43.
childrulesItem.Version = 1;
44.
childrulesItem.Visible = true;
45.
childrulesItem.Enable = true;
46.
childrulesItem.ReadOnly = true;
47.
rulesItem.Items.Add(childrulesItem);
48.
49.
childrulesItem = new TreeRulesItem();
50.
childrulesItem.ID = 4;
51.
childrulesItem.Name = "d";
52.
childrulesItem.Version = 1;
53.
childrulesItem.Visible = true;
54.
childrulesItem.Enable = true;
55.
childrulesItem.ReadOnly = true;
56.
rulesItem.Items.Add(childrulesItem);
57.
58.
radtreelistviewGUIObjects.ItemsSource = this.ElementsTree;
where the class TreeRulesItem
definition is:
01.
public class TreeRulesItem : INotifyPropertyChanged
02.
{
03.
public long ID { get; set; }
04.
public string Name { get; set; }
05.
public ObservableCollection<
TreeRulesItem
> Items { get; set; }
06.
07.
public int Version { get; set; }
08.
09.
private bool? visible = null;
10.
private bool? enable = null;
11.
private bool? readOnly = null;
12.
13.
public bool? Visible
14.
{
15.
get
16.
{
17.
return this.visible;
18.
}
19.
set
20.
{
21.
if (this.visible != value)
22.
{
23.
this.visible = value;
24.
this.OnPropertyChanged("Visible");
25.
}
26.
}
27.
}
28.
29.
public bool? Enable
30.
{
31.
get
32.
{
33.
return this.enable;
34.
}
35.
set
36.
{
37.
if (this.enable != value)
38.
{
39.
this.enable = value;
40.
this.OnPropertyChanged("Enable");
41.
}
42.
}
43.
}
44.
45.
public bool? ReadOnly
46.
{
47.
get
48.
{
49.
return this.readOnly;
50.
}
51.
set
52.
{
53.
if (this.readOnly != value)
54.
{
55.
this.readOnly = value;
56.
this.OnPropertyChanged("ReadOnly");
57.
}
58.
}
59.
}
60.
61.
public event PropertyChangedEventHandler PropertyChanged;
62.
63.
private void OnPropertyChanged(string propertyName)
64.
{
65.
if (this.PropertyChanged != null)
66.
{
67.
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
68.
}
69.
}
70.
71.
public TreeRulesItem()
72.
{
73.
this.Items = new ObservableCollection<
TreeRulesItem
>();
74.
}
75.
}
But when I expanding b element Checked event is triggered for elements b, c, d, e, f instead of e and f. Why is this happening or whether it is possible to distinguish between programmatically call the event and the call manually - when someone check the filed.