Features and fixes:
-
Upgrade to .NET 8
-
Fix right click and drag will "lock" tab item via this comment and Dragablz#275
Files changed:
- DragablzItem.cs (
Dragablz/Dragablz/DragablzItem.cs
Lines 483 to 499 in 2b70e0f
protected override async void OnPreviewMouseRightButtonDown(MouseButtonEventArgs e) { if (_thumb != null) { var currentThumbIsHitTestVisible = _thumb.IsHitTestVisible; _thumb.SetCurrentValue(IsHitTestVisibleProperty, false); while (Mouse.RightButton == MouseButtonState.Pressed) { await Task.Delay(25); }; _thumb.SetCurrentValue(IsHitTestVisibleProperty, currentThumbIsHitTestVisible); } base.OnPreviewMouseRightButtonDown(e); }
- DragablzItem.cs (
-
Use
DependencyProperty
forPartition
inInterTabController
andLayout
to allow binding via Dragablz#275Files changed:
- InterTabController.cs (
Dragablz/Dragablz/InterTabController.cs
Lines 51 to 62 in ac26a18
public static readonly DependencyProperty PartitionProperty = DependencyProperty.Register( "Partition", typeof (object), typeof (InterTabController), new PropertyMetadata(default(object))); /// <summary> /// The partition allows on or more tab environments in a single application. Only tabs which have a tab controller /// with a common partition will be allowed to have tabs dragged between them. <c>null</c> is a valid partition (i.e global). /// </summary> public object Partition { get { return (object) GetValue(PartitionProperty); } set { SetValue(PartitionProperty, value); } } - TabablzControl.cs (
Dragablz/Dragablz/TabablzControl.cs
Line 976 in ac26a18
e.DragablzItem.PartitionAtDragStart = InterTabController?.Partition.ToString(); - Dockablz\Layout.cs (
Dragablz/Dragablz/Dockablz/Layout.cs
Lines 195 to 213 in ac26a18
// Add parition as dependency property public static readonly DependencyProperty PartitionProperty = DependencyProperty.Register( "Partition", typeof (object), typeof (Layout), new PropertyMetadata(default(object))); /// <summary> /// Use in conjuction with the <see cref="InterTabController.Partition"/> on a <see cref="TabablzControl"/> /// to isolate drag and drop spaces/control instances. /// </summary> public object Partition { get { return (object) GetValue(PartitionProperty); } set { SetValue(PartitionProperty, value); } } /// <summary> /// Use in conjuction with the <see cref="InterTabController.Partition"/> on a <see cref="TabablzControl"/> /// to isolate drag and drop spaces/control instances. /// </summary> //public string Partition { get; set; } Dragablz/Dragablz/Dockablz/Layout.cs
Line 466 in ac26a18
l.Partition?.ToString() == dragablzItem.PartitionAtDragStart &&
- InterTabController.cs (
-
Fix closing tab in layout branch if
TabEmptiedResponse.DoNothing
Files changed: - TabEmptiedResponse.cs (
Dragablz/Dragablz/TabEmptiedResponse.cs
Lines 10 to 13 in 7ac6fe4
/// <summary> /// Allow the Layout branch to be closed automatically, but not the window. /// </summary> CloseLayoutBranch, Dragablz/Dragablz/TabablzControl.cs
Lines 1094 to 1156 in 7ac6fe4
internal object RemoveItem(DragablzItem dragablzItem) { var item = _dragablzItemsControl.ItemContainerGenerator.ItemFromContainer(dragablzItem); //stop the header shrinking if the tab stays open when empty var minSize = EmptyHeaderSizingHint == EmptyHeaderSizingHint.PreviousTab ? new Size(_dragablzItemsControl.ActualWidth, _dragablzItemsControl.ActualHeight) : new Size(); _dragablzItemsControl.MinHeight = 0; _dragablzItemsControl.MinWidth = 0; var contentPresenter = FindChildContentPresenter(item); RemoveFromSource(item); _itemsHolder.Children.Remove(contentPresenter); if (Items.Count != 0) return item; // Find window var window = Window.GetWindow(this); if (window == null || InterTabController == null) { _dragablzItemsControl.MinHeight = minSize.Height; _dragablzItemsControl.MinWidth = minSize.Width; return item; } // Get tab emptied response var tabEmptiedResponse = InterTabController.InterTabClient.TabEmptiedHandler(this, window); // This is e.g. to DoNothing if (tabEmptiedResponse is not (TabEmptiedResponse.CloseLayoutBranch or TabEmptiedResponse.CloseWindowOrLayoutBranch)) { _dragablzItemsControl.MinHeight = minSize.Height; _dragablzItemsControl.MinWidth = minSize.Width; return item; } // Consolidate branch if (Layout.ConsolidateBranch(this)) return item; // Close window if (tabEmptiedResponse is TabEmptiedResponse.CloseWindowOrLayoutBranch) { try { SetIsClosingAsPartOfDragOperation(window, true); window.Close(); } finally { SetIsClosingAsPartOfDragOperation(window, false); } } return item; } -
Feature: DependencyProperty to disable consolidate branch in TabalzControl added (e.g. to keep the main TabablzControl that is responsible for creating new tabs) Files changed: - TabablzControl.cs (
Dragablz/Dragablz/TabablzControl.cs
Lines 1110 to 1170 in a757598
internal object RemoveItem(DragablzItem dragablzItem) { var item = _dragablzItemsControl.ItemContainerGenerator.ItemFromContainer(dragablzItem); //stop the header shrinking if the tab stays open when empty var minSize = EmptyHeaderSizingHint == EmptyHeaderSizingHint.PreviousTab ? new Size(_dragablzItemsControl.ActualWidth, _dragablzItemsControl.ActualHeight) : new Size(); _dragablzItemsControl.MinHeight = 0; _dragablzItemsControl.MinWidth = 0; var contentPresenter = FindChildContentPresenter(item); RemoveFromSource(item); _itemsHolder.Children.Remove(contentPresenter); // Return if it is not the last item if (Items.Count != 0) return item; // Set min size _dragablzItemsControl.MinHeight = minSize.Height; _dragablzItemsControl.MinWidth = minSize.Width; // Disable branch consolidation (close branch or window is ignored) if (DisableBranchConsolidation) return item; // Find window var window = Window.GetWindow(this); if (window == null || InterTabController == null) return item; // Get tab emptied response var tabEmptiedResponse = InterTabController.InterTabClient.TabEmptiedHandler(this, window); // This is e.g. to DoNothing if (tabEmptiedResponse is not (TabEmptiedResponse.CloseLayoutBranch or TabEmptiedResponse.CloseWindowOrLayoutBranch)) return item; // Consolidate branch if (Layout.ConsolidateBranch(this)) return item; // Close window if (tabEmptiedResponse is TabEmptiedResponse.CloseWindowOrLayoutBranch) { try { SetIsClosingAsPartOfDragOperation(window, true); window.Close(); } finally { SetIsClosingAsPartOfDragOperation(window, false); } } return item; } Dragablz/Dragablz/TabablzControl.cs
Lines 373 to 388 in a757598
public static readonly DependencyProperty DisableBranchConsolidationProperty = DependencyProperty.Register( "DisableBranchConsolidation", typeof (bool), typeof (TabablzControl), new PropertyMetadata(default(bool))); /// <summary> /// Disable the consolidation of branches when a tab is dragged out of a branch. Set it to <c>true</c> if you have /// a main TabablzControl that is used to create new tab items and you don't want to remove this TabaBlzControl /// when the last tab is dragged out. In dynamically created TabablzControls this property should then be set to /// <c>false</c> (default). /// If this is set to <c>true</c> the <see cref="TabEmptiedResponse.CloseLayoutBranch"/> and <see cref="TabEmptiedResponse.CloseWindowOrLayoutBranch"/> /// is ignored. /// </summary> public bool DisableBranchConsolidation { get { return (bool) GetValue(DisableBranchConsolidationProperty); } set { SetValue(DisableBranchConsolidationProperty, value); } } Dragablz/Dragablz/TabablzControl.cs
Lines 1261 to 1268 in a757598
if (Items.Count == 0) { _dragablzItemsControl.MinHeight = minSize.Height; _dragablzItemsControl.MinWidth = minSize.Width; if(!DisableBranchConsolidation) Layout.ConsolidateBranch(this); }