Example #1
0
        protected override void OnClick()
        {
            base.OnClick();

            if (!string.IsNullOrEmpty(Name) && Name == "PART_Close_TabItem")
            {
                TabItemClose itemclose = VisualHelper.FindVisualParent <TabItemClose>(this);
                (itemclose.Parent as TabControl).Items.Remove(itemclose);
                RoutedEventArgs args = new RoutedEventArgs(TabItemClose.CloseItemEvent, itemclose);
                itemclose.RaiseEvent(args);
            }
        }
Example #2
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value == null || !(value is TreeViewItem))
     {
         return(new System.Windows.Thickness(0, 0, 0, 0));
     }
     else
     {
         var P = VisualHelper.FindVisualParent((TreeViewItem)value, null, typeof(TreeViewItem));
         if (P != null)
         {
             var C = VisualHelper.FindVisualChild(P, "Head_Grid", typeof(Grid)) as Grid;
             if (C != null)
             {
                 return(new Thickness(C.Margin.Left + 10, 0, 0, 0));
             }
         }
     }
     return(new System.Windows.Thickness(0, 0, 0, 0));
 }