Hi Valentin,
I'm just trying to get a list of objects of all the nodes that have been selected for a particular TreeViewItem. I've started to write an extension method to handle this for me but the IsSelected property doesn't seem to work. Am I checking the wrong property? Thanks. Here is the code:
public
static List<RadTreeViewItem> SelectedItemsX(this RadTreeViewItem treeView)
{
if (treeView == null) throw new ArgumentNullException();
var treeViewItemList = new List<RadTreeViewItem>();
var list = treeView.ItemsSource as IEnumerable;
if (list == null)
return treeViewItemList;
foreach (var item in list)
{
var itemFound = treeView.ParentTreeView.ContainerFromItemRecursive(item);
//IsSelected here never seems to return true
if (itemFound != null && itemFound.IsSelected == true)
treeViewItemList.Add(itemFound);
}
return treeViewItemList;
}
Thanks.
-jo