/// <summary> /// Associate the parent TreeViewItem with the CheckBox. /// </summary> private void AssociateParentTreeViewItem() { _parent = TreeViewExtensions.GetParentItemsControl(this) as TreeViewItem; if (_parent != null) { TreeViewExtensions.SetAssociatedCheckBox(_parent, this); } }
/// <summary> /// Update the TreeViewItem's IsChecked property when this IsChecked /// property is changed. /// </summary> /// <param name="sender">The CheckBox.</param> /// <param name="e">Event arguments.</param> private void OnIsCheckedChanged(object sender, RoutedEventArgs e) { TreeViewItem item = ParentTreeViewItem; if (item != null) { TreeViewExtensions.SetIsChecked(item, IsChecked); } }