diff --git a/api/Avalonia.nupkg.xml b/api/Avalonia.nupkg.xml index b2a81dd55d..86fd0cdd75 100644 --- a/api/Avalonia.nupkg.xml +++ b/api/Avalonia.nupkg.xml @@ -5641,4 +5641,100 @@ baseline/Avalonia/lib/netstandard2.0/Avalonia.Base.dll current/Avalonia/lib/netstandard2.0/Avalonia.Base.dll + + CP0002 + F:Avalonia.Controls.NavigationPage.IsBackButtonEffectivelyVisibleProperty + baseline/Avalonia/lib/net10.0/Avalonia.Controls.dll + current/Avalonia/lib/net10.0/Avalonia.Controls.dll + + + CP0002 + M:Avalonia.Controls.NavigationPage.get_IsBackButtonEffectivelyVisible + baseline/Avalonia/lib/net10.0/Avalonia.Controls.dll + current/Avalonia/lib/net10.0/Avalonia.Controls.dll + + + CP0002 + F:Avalonia.Controls.PipsPager.PreviousButtonStyleProperty + baseline/Avalonia/lib/net10.0/Avalonia.Controls.dll + current/Avalonia/lib/net10.0/Avalonia.Controls.dll + + + CP0002 + F:Avalonia.Controls.PipsPager.NextButtonStyleProperty + baseline/Avalonia/lib/net10.0/Avalonia.Controls.dll + current/Avalonia/lib/net10.0/Avalonia.Controls.dll + + + CP0002 + M:Avalonia.Controls.PipsPager.get_PreviousButtonStyle + baseline/Avalonia/lib/net10.0/Avalonia.Controls.dll + current/Avalonia/lib/net10.0/Avalonia.Controls.dll + + + CP0002 + M:Avalonia.Controls.PipsPager.set_PreviousButtonStyle(Avalonia.Styling.ControlTheme) + baseline/Avalonia/lib/net10.0/Avalonia.Controls.dll + current/Avalonia/lib/net10.0/Avalonia.Controls.dll + + + CP0002 + M:Avalonia.Controls.PipsPager.get_NextButtonStyle + baseline/Avalonia/lib/net10.0/Avalonia.Controls.dll + current/Avalonia/lib/net10.0/Avalonia.Controls.dll + + + CP0002 + M:Avalonia.Controls.PipsPager.set_NextButtonStyle(Avalonia.Styling.ControlTheme) + baseline/Avalonia/lib/net10.0/Avalonia.Controls.dll + current/Avalonia/lib/net10.0/Avalonia.Controls.dll + + + CP0002 + F:Avalonia.Controls.NavigationPage.IsBackButtonEffectivelyVisibleProperty + baseline/Avalonia/lib/net8.0/Avalonia.Controls.dll + current/Avalonia/lib/net8.0/Avalonia.Controls.dll + + + CP0002 + M:Avalonia.Controls.NavigationPage.get_IsBackButtonEffectivelyVisible + baseline/Avalonia/lib/net8.0/Avalonia.Controls.dll + current/Avalonia/lib/net8.0/Avalonia.Controls.dll + + + CP0002 + F:Avalonia.Controls.PipsPager.PreviousButtonStyleProperty + baseline/Avalonia/lib/net8.0/Avalonia.Controls.dll + current/Avalonia/lib/net8.0/Avalonia.Controls.dll + + + CP0002 + F:Avalonia.Controls.PipsPager.NextButtonStyleProperty + baseline/Avalonia/lib/net8.0/Avalonia.Controls.dll + current/Avalonia/lib/net8.0/Avalonia.Controls.dll + + + CP0002 + M:Avalonia.Controls.PipsPager.get_PreviousButtonStyle + baseline/Avalonia/lib/net8.0/Avalonia.Controls.dll + current/Avalonia/lib/net8.0/Avalonia.Controls.dll + + + CP0002 + M:Avalonia.Controls.PipsPager.set_PreviousButtonStyle(Avalonia.Styling.ControlTheme) + baseline/Avalonia/lib/net8.0/Avalonia.Controls.dll + current/Avalonia/lib/net8.0/Avalonia.Controls.dll + + + CP0002 + M:Avalonia.Controls.PipsPager.get_NextButtonStyle + baseline/Avalonia/lib/net8.0/Avalonia.Controls.dll + current/Avalonia/lib/net8.0/Avalonia.Controls.dll + + + CP0002 + M:Avalonia.Controls.PipsPager.set_NextButtonStyle(Avalonia.Styling.ControlTheme) + baseline/Avalonia/lib/net8.0/Avalonia.Controls.dll + current/Avalonia/lib/net8.0/Avalonia.Controls.dll + diff --git a/samples/ControlCatalog/Pages/PipsPager/PipsPagerCustomButtonsPage.xaml b/samples/ControlCatalog/Pages/PipsPager/PipsPagerCustomButtonThemesPage.xaml similarity index 83% rename from samples/ControlCatalog/Pages/PipsPager/PipsPagerCustomButtonsPage.xaml rename to samples/ControlCatalog/Pages/PipsPager/PipsPagerCustomButtonThemesPage.xaml index 8b9856424d..3e32f253f5 100644 --- a/samples/ControlCatalog/Pages/PipsPager/PipsPagerCustomButtonsPage.xaml +++ b/samples/ControlCatalog/Pages/PipsPager/PipsPagerCustomButtonThemesPage.xaml @@ -1,17 +1,17 @@ + x:Class="ControlCatalog.Pages.PipsPagerCustomButtonThemesPage"> - + Text="Replace the default chevron navigation buttons with custom button themes using PreviousButtonTheme and NextButtonTheme." /> - - + + @@ -27,7 +27,7 @@ - + @@ -41,7 +41,7 @@ - + @@ -56,12 +56,12 @@ - - - - - - + + + + + + diff --git a/samples/ControlCatalog/Pages/PipsPager/PipsPagerCustomButtonThemesPage.xaml.cs b/samples/ControlCatalog/Pages/PipsPager/PipsPagerCustomButtonThemesPage.xaml.cs new file mode 100644 index 0000000000..26682b9d61 --- /dev/null +++ b/samples/ControlCatalog/Pages/PipsPager/PipsPagerCustomButtonThemesPage.xaml.cs @@ -0,0 +1,11 @@ +using Avalonia.Controls; + +namespace ControlCatalog.Pages; + +public partial class PipsPagerCustomButtonThemesPage : UserControl +{ + public PipsPagerCustomButtonThemesPage() + { + InitializeComponent(); + } +} diff --git a/samples/ControlCatalog/Pages/PipsPager/PipsPagerCustomButtonsPage.xaml.cs b/samples/ControlCatalog/Pages/PipsPager/PipsPagerCustomButtonsPage.xaml.cs deleted file mode 100644 index 4fc74995bc..0000000000 --- a/samples/ControlCatalog/Pages/PipsPager/PipsPagerCustomButtonsPage.xaml.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Avalonia.Controls; - -namespace ControlCatalog.Pages; - -public partial class PipsPagerCustomButtonsPage : UserControl -{ - public PipsPagerCustomButtonsPage() - { - InitializeComponent(); - } -} diff --git a/samples/ControlCatalog/Pages/PipsPagerPage.xaml.cs b/samples/ControlCatalog/Pages/PipsPagerPage.xaml.cs index 33cc6d0fdf..0559a265e4 100644 --- a/samples/ControlCatalog/Pages/PipsPagerPage.xaml.cs +++ b/samples/ControlCatalog/Pages/PipsPagerPage.xaml.cs @@ -25,9 +25,9 @@ namespace ControlCatalog.Pages ("Appearance", "Custom Colors", "Override pip indicator colors using resource keys for normal, selected, and hover states.", () => new PipsPagerCustomColorsPage()), - ("Appearance", "Custom Buttons", - "Replace the default chevron navigation buttons with custom styled buttons.", - () => new PipsPagerCustomButtonsPage()), + ("Appearance", "Custom Button Themes", + "Replace the default chevron navigation buttons with custom button themes.", + () => new PipsPagerCustomButtonThemesPage()), ("Appearance", "Custom Templates", "Override pip item templates to create squares, pills, numbers, or any custom shape.", () => new PipsPagerCustomTemplatesPage()), diff --git a/src/Avalonia.Controls/Page/NavigationPage.cs b/src/Avalonia.Controls/Page/NavigationPage.cs index 8e38fbbdbc..e736535e75 100644 --- a/src/Avalonia.Controls/Page/NavigationPage.cs +++ b/src/Avalonia.Controls/Page/NavigationPage.cs @@ -63,13 +63,14 @@ namespace Avalonia.Controls private ContentPresenter? _modalPresenter; private ContentPresenter? _topCommandBarPresenter; private IDisposable? _hasNavigationBarSub; + private IDisposable? _hasBackButtonSub; private IDisposable? _isBackButtonEnabledSub; private IDisposable? _barLayoutBehaviorSub; private IDisposable? _barHeightSub; private IDisposable? _backButtonContentSub; private bool _isNavigating; private bool _canGoBack; - private bool? _isBackButtonEffectivelyVisible; + private bool _isBackButtonEffectivelyVisible; private bool _isNavBarEffectivelyVisible; private double _effectiveBarHeight; private bool _isBackButtonEffectivelyEnabled; @@ -110,8 +111,8 @@ namespace Avalonia.Controls /// /// Defines the property. /// - public static readonly DirectProperty IsBackButtonEffectivelyVisibleProperty = - AvaloniaProperty.RegisterDirect(nameof(IsBackButtonEffectivelyVisible), o => o.IsBackButtonEffectivelyVisible); + public static readonly DirectProperty IsBackButtonEffectivelyVisibleProperty = + AvaloniaProperty.RegisterDirect(nameof(IsBackButtonEffectivelyVisible), o => o.IsBackButtonEffectivelyVisible); /// /// Defines the property. @@ -330,7 +331,7 @@ namespace Avalonia.Controls /// /// Gets the effective back-button visibility. /// - public bool? IsBackButtonEffectivelyVisible + public bool IsBackButtonEffectivelyVisible { get => _isBackButtonEffectivelyVisible; private set => SetAndRaise(IsBackButtonEffectivelyVisibleProperty, ref _isBackButtonEffectivelyVisible, value); @@ -730,6 +731,8 @@ namespace Avalonia.Controls _hasNavigationBarSub?.Dispose(); _hasNavigationBarSub = null; + _hasBackButtonSub?.Dispose(); + _hasBackButtonSub = null; _isBackButtonEnabledSub?.Dispose(); _isBackButtonEnabledSub = null; _barLayoutBehaviorSub?.Dispose(); @@ -1840,6 +1843,9 @@ namespace Avalonia.Controls _hasNavigationBarSub?.Dispose(); _hasNavigationBarSub = null; + _hasBackButtonSub?.Dispose(); + _hasBackButtonSub = null; + _isBackButtonEnabledSub?.Dispose(); _isBackButtonEnabledSub = null; @@ -1857,6 +1863,9 @@ namespace Avalonia.Controls _hasNavigationBarSub = page.GetObservable(HasNavigationBarProperty) .Subscribe(new AnonymousObserver(_ => UpdateIsNavBarEffectivelyVisible())); + _hasBackButtonSub = page.GetObservable(HasBackButtonProperty) + .Subscribe(new AnonymousObserver(_ => UpdateIsBackButtonEffectivelyVisible())); + _isBackButtonEnabledSub = page.GetObservable(IsBackButtonEnabledProperty) .Subscribe(new AnonymousObserver(_ => UpdateIsBackButtonEffectivelyEnabled())); diff --git a/src/Avalonia.Controls/PipsPager/PipsPager.cs b/src/Avalonia.Controls/PipsPager/PipsPager.cs index b976df4826..a83c4ade0d 100644 --- a/src/Avalonia.Controls/PipsPager/PipsPager.cs +++ b/src/Avalonia.Controls/PipsPager/PipsPager.cs @@ -87,16 +87,16 @@ namespace Avalonia.Controls x => x.TemplateSettings); /// - /// Defines the property. + /// Defines the property. /// - public static readonly StyledProperty PreviousButtonStyleProperty = - AvaloniaProperty.Register(nameof(PreviousButtonStyle)); + public static readonly StyledProperty PreviousButtonThemeProperty = + AvaloniaProperty.Register(nameof(PreviousButtonTheme)); /// - /// Defines the property. + /// Defines the property. /// - public static readonly StyledProperty NextButtonStyleProperty = - AvaloniaProperty.Register(nameof(NextButtonStyle)); + public static readonly StyledProperty NextButtonThemeProperty = + AvaloniaProperty.Register(nameof(NextButtonTheme)); /// /// Defines the event. @@ -195,21 +195,21 @@ namespace Avalonia.Controls } /// - /// Gets or sets the style for the previous button. + /// Gets or sets the theme for the previous button. /// - public ControlTheme? PreviousButtonStyle + public ControlTheme? PreviousButtonTheme { - get => GetValue(PreviousButtonStyleProperty); - set => SetValue(PreviousButtonStyleProperty, value); + get => GetValue(PreviousButtonThemeProperty); + set => SetValue(PreviousButtonThemeProperty, value); } /// - /// Gets or sets the style for the next button. + /// Gets or sets the theme for the next button. /// - public ControlTheme? NextButtonStyle + public ControlTheme? NextButtonTheme { - get => GetValue(NextButtonStyleProperty); - set => SetValue(NextButtonStyleProperty, value); + get => GetValue(NextButtonThemeProperty); + set => SetValue(NextButtonThemeProperty, value); } /// diff --git a/src/Avalonia.Themes.Fluent/Controls/PipsPager.xaml b/src/Avalonia.Themes.Fluent/Controls/PipsPager.xaml index 6d20216a48..a331b63977 100644 --- a/src/Avalonia.Themes.Fluent/Controls/PipsPager.xaml +++ b/src/Avalonia.Themes.Fluent/Controls/PipsPager.xaml @@ -13,12 +13,12 @@ M 2.29,8.12 L 7.00,3.41 C 7.27,3.14 7.71,3.14 7.98,3.41 L 12.69,8.12 C 13.14,8.57 12.82,9.33 12.19,9.33 L 2.79,9.33 C 2.16,9.33 1.84,8.57 2.29,8.12 Z M 2.29,3.88 L 7.00,8.59 C 7.27,8.86 7.71,8.86 7.98,8.59 L 12.69,3.88 C 13.14,3.43 12.82,2.67 12.19,2.67 L 2.79,2.67 C 2.16,2.67 1.84,3.43 2.29,3.88 Z - + - + - - + + @@ -41,16 +41,20 @@ @@ -73,6 +77,21 @@ + + + + + + + + + + + + + @@ -122,8 +161,8 @@ - - + +