diff --git a/Maui.Tabs/Maui.Tabs.csproj b/Maui.Tabs/Maui.Tabs.csproj index 8b79bf7..9e45bfb 100644 --- a/Maui.Tabs/Maui.Tabs.csproj +++ b/Maui.Tabs/Maui.Tabs.csproj @@ -1,13 +1,12 @@  - net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst - $(TargetFrameworks);net6.0-windows10.0.19041.0 + net9.0 Sharpnado.Tabs - true true + true enable 14.2 @@ -128,6 +127,10 @@ + + all + runtime + all diff --git a/Tabs/Tabs/DelayedView.cs b/Tabs/Tabs/DelayedView.cs index d27db0d..91eac60 100644 --- a/Tabs/Tabs/DelayedView.cs +++ b/Tabs/Tabs/DelayedView.cs @@ -14,7 +14,7 @@ public override void LoadView() async () => { View? view = null; - if (Device.RuntimePlatform == Device.Android) + if (DeviceInfo.Platform == DevicePlatform.Android) { await Task.Run( () => diff --git a/Tabs/Tabs/TabHostView.cs b/Tabs/Tabs/TabHostView.cs index 256d910..2b4b572 100644 --- a/Tabs/Tabs/TabHostView.cs +++ b/Tabs/Tabs/TabHostView.cs @@ -7,6 +7,8 @@ using System.Linq; using System.Runtime.CompilerServices; using System.Windows.Input; +using Microsoft.Maui.Controls.Shapes; + #if !NET6_0_OR_GREATER using Sharpnado.Shades; @@ -122,7 +124,7 @@ public class TabHostView : Shadows private const string Tag = nameof(TabHostView); private readonly Grid _grid; - private readonly Frame _frame; + private readonly Border _border; private List _selectableTabs = new(); private INotifyCollectionChanged _currentNotifyCollection; @@ -154,12 +156,13 @@ public TabHostView() BackgroundColor = BackgroundColor, }; - _frame = new Frame + _border = new Border { Padding = 0, - HasShadow = false, - IsClippedToBounds = true, - CornerRadius = CornerRadius, + StrokeShape = new RoundRectangle() + { + CornerRadius = CornerRadius, + }, #if NET6_0_OR_GREATER BackgroundColor = Colors.Transparent, #else @@ -167,7 +170,7 @@ public TabHostView() #endif HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill, - BorderColor = SegmentedOutlineColor, + Stroke = SegmentedOutlineColor, }; UpdateTabType(); @@ -446,12 +449,12 @@ private TabItem CreateTabItem(object item) private void UpdateSegmentedOutlineColor() { - if (_frame == null) + if (_border == null) { return; } - _frame.BorderColor = SegmentedOutlineColor; + _border.Stroke = SegmentedOutlineColor; foreach (var separator in _grid.Children.Where(c => c is BoxView)) { @@ -467,7 +470,7 @@ private void UpdateBackgroundColor() { if (IsSegmented) { - if (_frame == null) + if (_border == null) { return; } @@ -477,7 +480,7 @@ private void UpdateBackgroundColor() #else _grid.BackgroundColor = Color.Transparent; #endif - _frame.BackgroundColor = BackgroundColor; + _border.BackgroundColor = BackgroundColor; return; } @@ -487,7 +490,7 @@ private void UpdateBackgroundColor() } #if NET6_0_OR_GREATER - _frame.BackgroundColor = Colors.Transparent; + _border.BackgroundColor = Colors.Transparent; #else _frame.BackgroundColor = Color.Transparent; #endif @@ -496,12 +499,15 @@ private void UpdateBackgroundColor() private void UpdateCornerRadius() { - if (_frame == null) + if (_border == null) { return; } - _frame.CornerRadius = CornerRadius; + _border.StrokeShape = new RoundRectangle() + { + CornerRadius = CornerRadius, + }; } private void AddSeparators() @@ -583,8 +589,8 @@ private void UpdateTabType() if (IsSegmented) { - _frame.Content = _grid; - _frame.BackgroundColor = BackgroundColor; + _border.Content = _grid; + _border.BackgroundColor = BackgroundColor; #if NET6_0_OR_GREATER _grid.BackgroundColor = Colors.Transparent; @@ -594,10 +600,10 @@ private void UpdateTabType() } else { - _frame.Content = null; + _border.Content = null; #if NET6_0_OR_GREATER - _frame.BackgroundColor = Colors.Transparent; + _border.BackgroundColor = Colors.Transparent; #else _frame.BackgroundColor = Color.Transparent; #endif @@ -619,7 +625,7 @@ private void UpdateTabType() if (IsSegmented) { - _scrollView.Content = _frame; + _scrollView.Content = _border; } else { @@ -645,7 +651,7 @@ private void UpdateTabType() { if (IsSegmented) { - base.Content = _frame; + base.Content = _border; } else { @@ -707,23 +713,8 @@ private void AddTapCommand(TabItem tabItem) return; } - if (Device.RuntimePlatform == Device.UWP) - { - tabItem.GestureRecognizers.Add( - new TapGestureRecognizer { Command = TabItemTappedCommand, CommandParameter = tabItem }); - } - else - { -#if NET6_0_OR_GREATER - Sharpnado.Tabs.Effects.TouchEffect.SetColor(tabItem, tabItem.SelectedTabColor); - Sharpnado.Tabs.Effects.Commands.SetTap(tabItem, TabItemTappedCommand); - Sharpnado.Tabs.Effects.Commands.SetTapParameter(tabItem, tabItem); -#else - ViewEffect.SetTouchFeedbackColor(tabItem, tabItem.SelectedTabColor); - TapCommandEffect.SetTap(tabItem, TabItemTappedCommand); - TapCommandEffect.SetTapParameter(tabItem, tabItem); -#endif - } + tabItem.GestureRecognizers.Add( + new TapGestureRecognizer { Command = TabItemTappedCommand, CommandParameter = tabItem }); } private void OnChildAdded(TabItem tabItem, int index)