diff options
author | Vsevolod Kukol <sevoku@microsoft.com> | 2021-07-01 02:10:03 +0300 |
---|---|---|
committer | Vsevolod Kukol <sevoku@microsoft.com> | 2021-07-01 02:10:03 +0300 |
commit | 7e1ad14c8fd28fa2ccb4c27d6a8181fbf932135a (patch) | |
tree | 7a6585fb58ccfd10758aa71eb4d8623efb909621 | |
parent | 11ec2ea4b79e42c5571c17d85a0f8446698f9698 (diff) |
[Mac] Fix TableView layout and rendering on BigSur
Big Sur introduced a new NSTableViewStyle and additional weird behavior
breaking the layout and CanvasCell rendering.
-rw-r--r-- | Xwt.XamMac/Xwt.Mac/MacSystemInformation.cs | 2 | ||||
-rw-r--r-- | Xwt.XamMac/Xwt.Mac/NSTableViewBackend.cs | 4 | ||||
-rw-r--r-- | Xwt.XamMac/Xwt.Mac/OutlineViewBackend.cs | 4 | ||||
-rw-r--r-- | Xwt.XamMac/Xwt.Mac/TableViewBackend.cs | 13 |
4 files changed, 23 insertions, 0 deletions
diff --git a/Xwt.XamMac/Xwt.Mac/MacSystemInformation.cs b/Xwt.XamMac/Xwt.Mac/MacSystemInformation.cs index 9241b36b..f3b88653 100644 --- a/Xwt.XamMac/Xwt.Mac/MacSystemInformation.cs +++ b/Xwt.XamMac/Xwt.Mac/MacSystemInformation.cs @@ -30,6 +30,8 @@ namespace Xwt.Mac { class MacSystemInformation { + public static readonly Version BigSur = new Version(10, 16); + public static readonly Version Catalina = new Version(10, 15); public static readonly Version Mojave = new Version(10, 14); public static readonly Version HighSierra = new Version(10, 13); public static readonly Version Sierra = new Version (10, 12); diff --git a/Xwt.XamMac/Xwt.Mac/NSTableViewBackend.cs b/Xwt.XamMac/Xwt.Mac/NSTableViewBackend.cs index c83d0d77..6ba73bc6 100644 --- a/Xwt.XamMac/Xwt.Mac/NSTableViewBackend.cs +++ b/Xwt.XamMac/Xwt.Mac/NSTableViewBackend.cs @@ -108,6 +108,10 @@ namespace Xwt.Mac public NSTableViewBackend (ListViewBackend viewBackend) { Backend = viewBackend; AllowsColumnReordering = false; + if (MacSystemInformation.OsVersion >= MacSystemInformation.BigSur) + { + Style = NSTableViewStyle.FullWidth; + } } public ViewBackend Backend { get; set; } diff --git a/Xwt.XamMac/Xwt.Mac/OutlineViewBackend.cs b/Xwt.XamMac/Xwt.Mac/OutlineViewBackend.cs index 8684ded9..d424dec6 100644 --- a/Xwt.XamMac/Xwt.Mac/OutlineViewBackend.cs +++ b/Xwt.XamMac/Xwt.Mac/OutlineViewBackend.cs @@ -42,6 +42,10 @@ namespace Xwt.Mac { Backend = viewBackend; AllowsColumnReordering = false; + if (MacSystemInformation.OsVersion >= MacSystemInformation.BigSur) + { + Style = NSTableViewStyle.FullWidth; + } } public NSView View { diff --git a/Xwt.XamMac/Xwt.Mac/TableViewBackend.cs b/Xwt.XamMac/Xwt.Mac/TableViewBackend.cs index 8ab10565..1ac67c47 100644 --- a/Xwt.XamMac/Xwt.Mac/TableViewBackend.cs +++ b/Xwt.XamMac/Xwt.Mac/TableViewBackend.cs @@ -446,6 +446,19 @@ namespace Xwt.Mac // may be drawn already and it will not be redrawn even // if Selection has been changed. NeedsDisplay = true; + // Since Big Sur NSTableView doesn't refresh its subviews on selection change + if (MacSystemInformation.OsVersion >= MacSystemInformation.BigSur) + { + // We have always a CompositeCell with Subviews for real cell views + foreach (var sub in Subviews) + { + sub.NeedsDisplay = true; + foreach (var subsub in sub.Subviews) + { + subsub.NeedsDisplay = true; + } + } + } } } |