/// <summary>
        /// Gets the value of the ConnectingLineInfo attached property for a
        /// specified TreeViewItem.
        /// </summary>
        /// <param name="element">
        /// The TreeViewItem from which the property value is read.
        /// </param>
        /// <returns>
        /// The ConnectingLineInfo property value for the TreeViewItem.
        /// </returns>
        internal static TreeViewItemConnectingLineInfo GetConnectingLineInfo(TreeViewItem element)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }
            
            // Get the info and create on demand if necessary
            TreeViewItemConnectingLineInfo info = element.GetValue(ConnectingLineInfoProperty) as TreeViewItemConnectingLineInfo;
            if (info == null)
            {
                info = new TreeViewItemConnectingLineInfo(element);
                element.SetValue(ConnectingLineInfoProperty, info);
            }

            return info;
        }
        /// <summary>
        /// Gets the value of the ConnectingLineInfo attached property for a
        /// specified TreeViewItem.
        /// </summary>
        /// <param name="element">
        /// The TreeViewItem from which the property value is read.
        /// </param>
        /// <returns>
        /// The ConnectingLineInfo property value for the TreeViewItem.
        /// </returns>
        internal static TreeViewItemConnectingLineInfo GetConnectingLineInfo(TreeViewItem element)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            // Get the info and create on demand if necessary
            TreeViewItemConnectingLineInfo info = element.GetValue(ConnectingLineInfoProperty) as TreeViewItemConnectingLineInfo;

            if (info == null)
            {
                info = new TreeViewItemConnectingLineInfo(element);
                element.SetValue(ConnectingLineInfoProperty, info);
            }

            return(info);
        }
 public static bool GetIsBroughtIntoViewWhenSelected(TreeViewItem treeViewItem)
 {
     return (bool)treeViewItem.GetValue(IsBroughtIntoViewWhenSelectedProperty);
 }
 public static bool GetIsTreeViewItemDropOver(TreeViewItem item)
 {
     return (bool)item.GetValue(IsTreeViewItemDropOverProperty);
 }
 public static bool GetIsItemSelected(TreeViewItem element)
 {
     return (bool)element.GetValue(IsItemSelectedProperty);
 }
 public static bool GetBringSelectionIntoView(TreeViewItem treeViewItem)
 {
     return (bool)treeViewItem.GetValue(BringSelectionIntoViewProperty);
 }
 public static bool GetIsFiltered(TreeViewItem item)
 {
     return (bool)item.GetValue(IsFilteredProperty);
 }
 public static bool GetEnableContextMenuWorkaround(TreeViewItem treeViewItem)
     => (bool) treeViewItem.GetValue(EnableContextMenuWorkaroundProperty);
 public static bool GetEnableFullRowSelection(TreeViewItem treeViewItem)
     => (bool) treeViewItem.GetValue(EnableFullRowSelectionProperty);
 public static bool GetBringIntoViewWhenSelected(TreeViewItem treeViewItem)
 {
     return (bool)treeViewItem.GetValue(BringIntoViewWhenSelectedProperty);
 }
 /// <summary>
 /// Gets the value of the AssociatedToolbarItem attached property for a specified TreeViewItem.
 /// </summary>
 /// <param name="element">The TreeViewItem from which the property value is read.</param>
 /// <returns>The AssociatedToolbarItem property value for the TreeViewItem.</returns>
 internal static AddToolbarItem GetAssociatedToolbarItem(TreeViewItem element)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     return element.GetValue(AssociatedToolbarItemProperty) as AddToolbarItem;
 }
 private Connection getParentConnectionForTreeViewItem(TreeViewItem item)
 {
     if (item == null)
         return null;
     Resource resource = item.DataContext as Resource;
     if (resource != null)
     {
         Connection c = item.GetValue(TreeViewItemExtensions.ConnectionProperty) as Connection;
         if (c != null)
             return c;
     }
     Connection ds = item.DataContext as Connection;
     if (ds != null)
         return ds;
     TreeViewItem parent = item.Parent as TreeViewItem;
     if (parent == null)
         parent = ControlTreeHelper.FindAncestorOfType<TreeViewItem>(item);
     if (parent == null)
         return null;
     return getParentConnectionForTreeViewItem(parent);
 }