I have a treeview as outlined below. Whenever an item is checked/unchecked, I 'do something' in the code-behind.
However, if the user checks the root, all items are checked /unchecked and I get an event for each. I just want to know when it's done so I can inspect the state of the relevant items.
I can't find a relevant event; even mouseDown doesn't seem to 'fire' in my case?! What could you recommend?
Thanks for any commments,
Anders, Denmark
<Controls1:RadTreeView
ItemsSource="{Binding Path=Children, NotifyOnSourceUpdated=True}"
Name="treeview"
IsLineEnabled="True"
IsOptionElementsEnabled="True"
ItemsOptionListType="CheckList"
IsTriStateMode="True" Checked="treeview_Checked" Unchecked="treeview_Checked">
5 Answers, 1 is accepted
The Checked event of the RadTreeView fire in the following order when you check a RadTreeViewItem
1) Children
2 (optional) Parent if (the clicked is single child)
3) The item you have clicked
The way to check the event is fired for the clicked item is:
private void treeView_Checked(object sender, Telerik.Windows.RadRoutedEventArgs e)
{
Debug.WriteLine(e.Source.ToString());
if ((e as RadTreeViewCheckEventArgs).IsUserInitiated == true)
{
///Logic after the checked operationn
}
}
All the best,
Petar Mladenov
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
Precisely what I was looking for - works like a charm.
Thanks,
Anders, Denmark
I want the same behavior but using your example it don't work for me. I'm using IsVirtualization and when I check the parent node it is the first element to rise the checked event.
Maybe I'm doing something wrong.
best regards,
Gonçalo
We highly encourage you to open a new support thread with more details on your scenario. This way we would be better able to advice you , furthermore you will receive a faster response.
Using Virtualization, DataBinging and TriStateMode may lead to various issues. Actually, if you need to bind the CheckedState of the items and use TriState behavior , you will have to implement your own TriState logic in the ViewModels. This is described in detail in this help article.
Petar Mladenov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
I dont know if I was clear about my problem, but I already found a solution and its working. :)
Thanks,
Gonçalo