From 49242e42e7ad45cc364ceef498edb88287d5cbdc Mon Sep 17 00:00:00 2001 From: Roman Shapiro Date: Fri, 4 Oct 2024 01:32:09 +0700 Subject: [PATCH] Another fix for closeable tabs --- .../Myra.Samples.CustomUIStylesheet.FNA.Core.csproj | 3 ++- src/Myra/Graphics2D/UI/Properties/PropertyGrid.cs | 3 +++ src/Myra/Graphics2D/UI/Selectors/TabControl.cs | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/samples/Myra.Samples.CustomUIStylesheet/Myra.Samples.CustomUIStylesheet.FNA.Core.csproj b/samples/Myra.Samples.CustomUIStylesheet/Myra.Samples.CustomUIStylesheet.FNA.Core.csproj index 4a8783ab..8e9b42cc 100644 --- a/samples/Myra.Samples.CustomUIStylesheet/Myra.Samples.CustomUIStylesheet.FNA.Core.csproj +++ b/samples/Myra.Samples.CustomUIStylesheet/Myra.Samples.CustomUIStylesheet.FNA.Core.csproj @@ -14,4 +14,5 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/src/Myra/Graphics2D/UI/Properties/PropertyGrid.cs b/src/Myra/Graphics2D/UI/Properties/PropertyGrid.cs index ac7159d8..892a47a9 100644 --- a/src/Myra/Graphics2D/UI/Properties/PropertyGrid.cs +++ b/src/Myra/Graphics2D/UI/Properties/PropertyGrid.cs @@ -206,6 +206,8 @@ public object Object _object = value; Rebuild(); + + ObjectChanged?.Invoke(this, EventArgs.Empty); } } @@ -340,6 +342,7 @@ public string Filter public Func CustomWidgetProvider; public event EventHandler> PropertyChanged; + public event EventHandler ObjectChanged; private PropertyGrid(TreeStyle style, string category, Record parentProperty, PropertyGrid parentGrid = null) { diff --git a/src/Myra/Graphics2D/UI/Selectors/TabControl.cs b/src/Myra/Graphics2D/UI/Selectors/TabControl.cs index 9ebd4e19..cee1c0fd 100644 --- a/src/Myra/Graphics2D/UI/Selectors/TabControl.cs +++ b/src/Myra/Graphics2D/UI/Selectors/TabControl.cs @@ -230,7 +230,6 @@ protected override void InsertItem(TabItem item, int index) var button = new ListViewButton { - Tag = item, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Height = item.Height, @@ -246,10 +245,13 @@ protected override void InsertItem(TabItem item, int index) if (!CloseableTabs) { + button.Tag = item; _gridButtons.Widgets.Insert(index, button); } else { var topItemPanel = new HorizontalStackPanel(); + topItemPanel.Tag = item; + topItemPanel.Widgets.Add(button); StackPanel.SetProportionType(button, ProportionType.Fill);