feat: wip.
This commit is contained in:
@@ -36,6 +36,12 @@ public class ToolBar: HeaderedItemsControl
|
||||
set => SetValue(BandProperty, value);
|
||||
}
|
||||
|
||||
public static readonly AttachedProperty<OverflowMode> OverflowModeProperty =
|
||||
AvaloniaProperty.RegisterAttached<ToolBar, Control?, OverflowMode>("OverflowMode");
|
||||
|
||||
public static void SetOverflowMode(Control? obj, OverflowMode value) => obj.SetValue(OverflowModeProperty, value);
|
||||
public static OverflowMode GetOverflowMode(Control? obj) => obj.GetValue(OverflowModeProperty);
|
||||
|
||||
static ToolBar()
|
||||
{
|
||||
IsTabStopProperty.OverrideDefaultValue<ToolBar>(false);
|
||||
|
||||
@@ -28,7 +28,24 @@ public class ToolBarPanel: StackPanel
|
||||
|
||||
protected override Size MeasureOverride(Size availableSize)
|
||||
{
|
||||
return base.MeasureOverride(availableSize);
|
||||
|
||||
var size = base.MeasureOverride(availableSize);
|
||||
var children = this.Children;
|
||||
var children2 = this.OverflowPanel?.Children;
|
||||
var all = children.ToList();
|
||||
if (children2 != null)
|
||||
{
|
||||
all.AddRange(children2);
|
||||
}
|
||||
this.Children.Clear();
|
||||
OverflowPanel?.Children.Clear();
|
||||
for (int i = 0; i < all.Count - 1; i++)
|
||||
{
|
||||
this.Children.Add(all[i]);
|
||||
}
|
||||
if (all.Count > 0)
|
||||
{
|
||||
OverflowPanel?.Children.Add(all.Last());
|
||||
}
|
||||
return size;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user