Hello,
I would like to toggle the check box of an item in a TreeView by Selecting the item. It makes it much easier for the user to 'check' the item without putting the mouse directly on the tiny checkbox for the item. Currently I have this partially working by using the following code:
The only issue I have with the above is if the user clicks on the item already selected nothing happens, the user must click another item OR just click the tiny checkbox. I'm using HierarchicalDataTemplate binding and TriStateMode. Any suggestions?? Thanks, Patrick
I would like to toggle the check box of an item in a TreeView by Selecting the item. It makes it much easier for the user to 'check' the item without putting the mouse directly on the tiny checkbox for the item. Currently I have this partially working by using the following code:
private
void
RadTreeView_Selected(
object
sender, Telerik.Windows.RadRoutedEventArgs e)
{
//This only works when it is a new selection, this event does not fire upon clicking on the already selected item
Telerik.Windows.Controls.RadTreeViewItem selectedItem = e.Source
as
Telerik.Windows.Controls.RadTreeViewItem;
if
(selectedItem.Level == 1)
{
if
(selectedItem.CheckState == ToggleState.Off)
{
selectedItem.CheckState = ToggleState.On;
}
else
{
selectedItem.CheckState = ToggleState.Off;
}
}
}
The only issue I have with the above is if the user clicks on the item already selected nothing happens, the user must click another item OR just click the tiny checkbox. I'm using HierarchicalDataTemplate binding and TriStateMode. Any suggestions?? Thanks, Patrick