This question is locked. New answers and comments are not allowed.
Hello,
create a new Telerik Silverlight application and replace
MainPage.xaml with:
and
MainPage.xaml.cs with:
Run the application:
The Checked and Unchecked events should really be raised only once in cases 1 and 5.
Case 2 is a special one, because the new state is indeterminate and there is no special event for this case.
Patrick
create a new Telerik Silverlight application and replace
MainPage.xaml with:
<UserControl x:Class="RadControlsSilverlightApp1.MainPage" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"> <Grid Margin="5"> <Grid.ColumnDefinitions> <ColumnDefinition /> <ColumnDefinition /> </Grid.ColumnDefinitions> <telerik:RadTreeView IsLineEnabled="True" IsOptionElementsEnabled="True" IsTriStateMode="True" ItemsOptionListType="CheckList" Margin="5" Checked="RadTreeView_Checked" Unchecked="RadTreeView_Unchecked"> <telerik:RadTreeViewItem Header="Group" IsExpanded="True"> <telerik:RadTreeViewItem Header="Item1" /> <telerik:RadTreeViewItem Header="Item2" /> <telerik:RadTreeViewItem Header="Item3" /> </telerik:RadTreeViewItem> </telerik:RadTreeView> <telerik:RadListBox Name="EventList" Margin="5" Grid.Column="1" /> </Grid></UserControl>and
MainPage.xaml.cs with:
using System;using System.Windows.Controls;using Telerik.Windows;namespace RadControlsSilverlightApp1{ public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); } private void RadTreeView_Checked(object sender, RadRoutedEventArgs e) { Dispatcher.BeginInvoke( () => EventList.Items.Add(DateTime.Now.ToString() + ": Checked") ); } private void RadTreeView_Unchecked(object sender, RadRoutedEventArgs e) { Dispatcher.BeginInvoke( () => EventList.Items.Add(DateTime.Now.ToString() + ": Unchecked") ); } }}Run the application:
- When you check Group, 4 Checked events are raised.
- Now if you uncheck Item1, one Checked and one Unchecked events are raised.
- Now if you uncheck Item2, one Unchecked event is raised: correct.
- Now if you check Item1, one Checked event is raised: correct.
- Now if you check Item2, two Checked events are raised.
The Checked and Unchecked events should really be raised only once in cases 1 and 5.
Case 2 is a special one, because the new state is indeterminate and there is no special event for this case.
Patrick