示例#1
0
 /// <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);
     }
 }
示例#2
0
        /// <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);
            }
        }