private Select ( bool selected ) : void | ||
selected | bool | /// A value indicating whether the TreeViewItem is selected. /// |
return | void |
private void Select(bool selected)
{
// Get the parent TreeView and make sure it's not already in the
// process of changing the selection
TreeView view = ParentTreeView;
if (view != null && !view.IsSelectionChangeActive)
{
// Change the selection in the TreeView
TreeViewItem parent = ParentTreeViewItem;
object item = (parent != null) ?
parent.ItemContainerGenerator.ItemFromContainer(this) :
view.ItemContainerGenerator.ItemFromContainer(this);
view.ChangeSelection(item, this, selected);
}
}