diff --git a/src/Uno.UI.FluentTheme.v2/Resources/Version2/PriorityDefault/InfoBar.xaml b/src/Uno.UI.FluentTheme.v2/Resources/Version2/PriorityDefault/InfoBar.xaml index 382ef8e3f56c..544ec8c7f93e 100644 --- a/src/Uno.UI.FluentTheme.v2/Resources/Version2/PriorityDefault/InfoBar.xaml +++ b/src/Uno.UI.FluentTheme.v2/Resources/Version2/PriorityDefault/InfoBar.xaml @@ -1,280 +1,179 @@  - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - + \ No newline at end of file diff --git a/src/Uno.UI.FluentTheme.v2/Resources/Version2/PriorityDefault/InfoBar_themeresources.xaml b/src/Uno.UI.FluentTheme.v2/Resources/Version2/PriorityDefault/InfoBar_themeresources.xaml index aafd3d8cea26..90b6c9c1228f 100644 --- a/src/Uno.UI.FluentTheme.v2/Resources/Version2/PriorityDefault/InfoBar_themeresources.xaml +++ b/src/Uno.UI.FluentTheme.v2/Resources/Version2/PriorityDefault/InfoBar_themeresources.xaml @@ -1,133 +1,97 @@  - - - + + - - - - - - - - - - - - - - - - - - - - - - 1 - - - - - - - - - - - - - - - - - - - - - - - - 1 - - - - - - - - - - - - - - - - - - - - - - - - 2 - + + + + + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + + + 2 + - 14 SemiBold - 14 Normal - 48 - 38 16 - - -12,0,0,0 - - 16,0,0,0 - 0,16,14,16 16 - 0,0,16,0 0,0,0,0 0,14,0,18 - 0,14,0,0 0,14,0,0 - 12,14,0,0 0,4,0,0 - 16,8,0,0 0,12,0,0 - Cancel - - - + diff --git a/src/Uno.UI.FluentTheme.v2/themeresources_v2.xaml b/src/Uno.UI.FluentTheme.v2/themeresources_v2.xaml index e3687b147ca2..e77bd19e431c 100644 --- a/src/Uno.UI.FluentTheme.v2/themeresources_v2.xaml +++ b/src/Uno.UI.FluentTheme.v2/themeresources_v2.xaml @@ -16531,12 +16531,12 @@ - - + + - + @@ -16607,7 +16607,7 @@ - + diff --git a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBar.Properties.cs b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBar.Properties.cs index 863c58da1305..365951c7b3fa 100644 --- a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBar.Properties.cs +++ b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBar.Properties.cs @@ -1,4 +1,4 @@ -// MUX reference InfoBar.properties.cpp, commit 3125489 +// MUX reference InfoBar.properties.cpp, tag winui3/release/1.4.2 #nullable enable @@ -7,271 +7,270 @@ using Windows.UI.Xaml; using Windows.UI.Xaml.Controls.Primitives; -namespace Microsoft.UI.Xaml.Controls +namespace Microsoft.UI.Xaml.Controls; + +public partial class InfoBar { - public partial class InfoBar + /// + /// Occurs after the close button is clicked in the InfoBar. + /// + public event TypedEventHandler CloseButtonClick; + + /// + /// Occurs just before the InfoBar begins to close. + /// + public event TypedEventHandler Closing; + + /// + /// Occurs after the InfoBar is closed. + /// + public event TypedEventHandler Closed; + + /// + /// Gets or sets the action button of the InfoBar. + /// + public ButtonBase ActionButton + { + get => (ButtonBase)GetValue(ActionButtonProperty); + set => SetValue(ActionButtonProperty, value); + } + + /// + /// Identifies the ActionButton dependency property. + /// + public static DependencyProperty ActionButtonProperty { get; } = + DependencyProperty.Register(nameof(ActionButton), typeof(ButtonBase), typeof(InfoBar), new FrameworkPropertyMetadata(null)); + + /// + /// Gets or sets the command to invoke when the close button is clicked in the InfoBar. + /// + public ICommand CloseButtonCommand + { + get => (ICommand)GetValue(CloseButtonCommandProperty); + set => SetValue(CloseButtonCommandProperty, value); + } + + /// + /// Gets or sets the parameter to pass to the command for the close button in the InfoBar. + /// + public static DependencyProperty CloseButtonCommandProperty { get; } = + DependencyProperty.Register(nameof(CloseButtonCommand), typeof(ICommand), typeof(InfoBar), new FrameworkPropertyMetadata(null)); + + /// + /// Identifies the CloseButtonCommandParameter dependency property. + /// + public object CloseButtonCommandParameter + { + get => (object)GetValue(CloseButtonCommandParameterProperty); + set => SetValue(CloseButtonCommandParameterProperty, value); + } + + /// + /// Identifies the CloseButtonCommand dependency property. + /// + public static DependencyProperty CloseButtonCommandParameterProperty { get; } = + DependencyProperty.Register(nameof(CloseButtonCommandParameter), typeof(object), typeof(InfoBar), new FrameworkPropertyMetadata(null)); + + /// + /// Gets or sets the Style to apply to the close button in the InfoBar. + /// + public Style CloseButtonStyle + { + get => (Style)GetValue(CloseButtonStyleProperty); + set => SetValue(CloseButtonStyleProperty, value); + } + + /// + /// Gets or sets the Style to apply to the close button in the InfoBar. + /// + public static DependencyProperty CloseButtonStyleProperty { get; } = + DependencyProperty.Register(nameof(CloseButtonStyle), typeof(Style), typeof(InfoBar), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.ValueDoesNotInheritDataContext)); + + /// + /// Gets or sets the XAML Content that is displayed below the title and message in the InfoBar. + /// + public object Content + { + get => (object)GetValue(ContentProperty); + set => SetValue(ContentProperty, value); + } + + /// + /// Identifies the Content dependency property. + /// + public static DependencyProperty ContentProperty { get; } = + DependencyProperty.Register(nameof(Content), typeof(object), typeof(InfoBar), new FrameworkPropertyMetadata(null)); + + /// + /// Gets or sets the data template for the InfoBar.Content. + /// + public DataTemplate ContentTemplate + { + get => (DataTemplate)GetValue(ContentTemplateProperty); + set => SetValue(ContentTemplateProperty, value); + } + + /// + /// Identifies the ContentTemplate dependency property. + /// + public static DependencyProperty ContentTemplateProperty { get; } = + DependencyProperty.Register(nameof(ContentTemplate), typeof(DataTemplate), typeof(InfoBar), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.ValueDoesNotInheritDataContext)); + + /// + /// Gets or sets the graphic content to appear alongside the title and message in the InfoBar. + /// + public IconSource IconSource + { + get => (IconSource)GetValue(IconSourceProperty); + set => SetValue(IconSourceProperty, value); + } + + /// + /// Identifies the IconSource dependency property. + /// + public static DependencyProperty IconSourceProperty { get; } = + DependencyProperty.Register(nameof(IconSource), typeof(IconSource), typeof(InfoBar), new FrameworkPropertyMetadata(null, OnIconSourcePropertyChanged)); + + /// + /// Identifies the IconSource dependency property. + /// + public bool IsClosable + { + get => (bool)GetValue(IsClosableProperty); + set => SetValue(IsClosableProperty, value); + } + + /// + /// Identifies the IsClosable dependency property. + /// + public static DependencyProperty IsClosableProperty { get; } = + DependencyProperty.Register(nameof(IsClosable), typeof(bool), typeof(InfoBar), new FrameworkPropertyMetadata(true, OnIsClosablePropertyChanged)); + + /// + /// Gets or sets a value that indicates whether the icon is visible in the InfoBar. + /// + public bool IsIconVisible + { + get => (bool)GetValue(IsIconVisibleProperty); + set => SetValue(IsIconVisibleProperty, value); + } + + /// + /// Identifies the IsIconVisible dependency property. + /// + public static DependencyProperty IsIconVisibleProperty { get; } = + DependencyProperty.Register(nameof(IsIconVisible), typeof(bool), typeof(InfoBar), new FrameworkPropertyMetadata(true, OnIsIconVisiblePropertyChanged)); + + /// + /// Gets or sets a value that indicates whether the InfoBar is open. + /// + public bool IsOpen + { + get => (bool)GetValue(IsOpenProperty); + set => SetValue(IsOpenProperty, value); + } + + /// + /// Identifies the IsOpen dependency property. + /// + public static DependencyProperty IsOpenProperty { get; } = + DependencyProperty.Register(nameof(IsOpen), typeof(bool), typeof(InfoBar), new FrameworkPropertyMetadata(false, OnIsOpenPropertyChanged)); + + /// + /// Gets or sets the message of the InfoBar. + /// + public string Message + { + get => (string)GetValue(MessageProperty); + set => SetValue(MessageProperty, value); + } + + /// + /// Identifies the Message dependency property. + /// + public static DependencyProperty MessageProperty { get; } = + DependencyProperty.Register(nameof(Message), typeof(string), typeof(InfoBar), new FrameworkPropertyMetadata(string.Empty)); + + /// + /// Gets or sets the type of the InfoBar to apply consistent status color, icon, + /// and assistive technology settings dependent on the criticality of the notification. + /// + public InfoBarSeverity Severity + { + get => (InfoBarSeverity)GetValue(SeverityProperty); + set => SetValue(SeverityProperty, value); + } + + /// + /// Identifies the Severity dependency property. + /// + public static DependencyProperty SeverityProperty { get; } = + DependencyProperty.Register(nameof(Severity), typeof(InfoBarSeverity), typeof(InfoBar), new FrameworkPropertyMetadata(InfoBarSeverity.Informational, OnSeverityPropertyChanged)); + + /// + /// Provides calculated values that can be referenced as TemplatedParent sources when defining templates for an InfoBar. + /// Not intended for general use. + /// + public InfoBarTemplateSettings TemplateSettings => (InfoBarTemplateSettings)GetValue(TemplateSettingsProperty); + + /// + /// Identifies the TemplateSettings dependency property. + /// + public static DependencyProperty TemplateSettingsProperty { get; } = + DependencyProperty.Register(nameof(TemplateSettings), typeof(InfoBarTemplateSettings), typeof(InfoBar), new FrameworkPropertyMetadata(null)); + + /// + /// Gets or sets the title of the InfoBar. + /// + public string Title + { + get => (string)GetValue(TitleProperty); + set => SetValue(TitleProperty, value); + } + + /// + /// Identifies the Title dependency property. + /// + public static DependencyProperty TitleProperty { get; } = + DependencyProperty.Register(nameof(Title), typeof(string), typeof(InfoBar), new FrameworkPropertyMetadata(string.Empty)); + + private static void OnIconSourcePropertyChanged( + DependencyObject sender, + DependencyPropertyChangedEventArgs args) + { + var owner = (InfoBar)sender; + owner.OnIconSourcePropertyChanged(args); + } + + private static void OnIsClosablePropertyChanged( + DependencyObject sender, + DependencyPropertyChangedEventArgs args) + { + var owner = (InfoBar)sender; + owner.OnIsClosablePropertyChanged(args); + } + + private static void OnIsIconVisiblePropertyChanged( + DependencyObject sender, + DependencyPropertyChangedEventArgs args) + { + var owner = (InfoBar)sender; + owner.OnIsIconVisiblePropertyChanged(args); + } + + private static void OnIsOpenPropertyChanged( + DependencyObject sender, + DependencyPropertyChangedEventArgs args) + { + var owner = (InfoBar)sender; + owner.OnIsOpenPropertyChanged(args); + } + + private static void OnSeverityPropertyChanged( + DependencyObject sender, + DependencyPropertyChangedEventArgs args) { - /// - /// Occurs after the close button is clicked in the InfoBar. - /// - public event TypedEventHandler CloseButtonClick; - - /// - /// Occurs just before the InfoBar begins to close. - /// - public event TypedEventHandler Closing; - - /// - /// Occurs after the InfoBar is closed. - /// - public event TypedEventHandler Closed; - - /// - /// Gets or sets the action button of the InfoBar. - /// - public ButtonBase ActionButton - { - get => (ButtonBase)GetValue(ActionButtonProperty); - set => SetValue(ActionButtonProperty, value); - } - - /// - /// Identifies the ActionButton dependency property. - /// - public static DependencyProperty ActionButtonProperty { get; } = - DependencyProperty.Register(nameof(ActionButton), typeof(ButtonBase), typeof(InfoBar), new FrameworkPropertyMetadata(null)); - - /// - /// Gets or sets the command to invoke when the close button is clicked in the InfoBar. - /// - public ICommand CloseButtonCommand - { - get => (ICommand)GetValue(CloseButtonCommandProperty); - set => SetValue(CloseButtonCommandProperty, value); - } - - /// - /// Gets or sets the parameter to pass to the command for the close button in the InfoBar. - /// - public static DependencyProperty CloseButtonCommandProperty { get; } = - DependencyProperty.Register(nameof(CloseButtonCommand), typeof(ICommand), typeof(InfoBar), new FrameworkPropertyMetadata(null)); - - /// - /// Identifies the CloseButtonCommandParameter dependency property. - /// - public object CloseButtonCommandParameter - { - get => (object)GetValue(CloseButtonCommandParameterProperty); - set => SetValue(CloseButtonCommandParameterProperty, value); - } - - /// - /// Identifies the CloseButtonCommand dependency property. - /// - public static DependencyProperty CloseButtonCommandParameterProperty { get; } = - DependencyProperty.Register(nameof(CloseButtonCommandParameter), typeof(object), typeof(InfoBar), new FrameworkPropertyMetadata(null)); - - /// - /// Gets or sets the Style to apply to the close button in the InfoBar. - /// - public Style CloseButtonStyle - { - get => (Style)GetValue(CloseButtonStyleProperty); - set => SetValue(CloseButtonStyleProperty, value); - } - - /// - /// Gets or sets the Style to apply to the close button in the InfoBar. - /// - public static DependencyProperty CloseButtonStyleProperty { get; } = - DependencyProperty.Register(nameof(CloseButtonStyle), typeof(Style), typeof(InfoBar), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.ValueDoesNotInheritDataContext)); - - /// - /// Gets or sets the XAML Content that is displayed below the title and message in the InfoBar. - /// - public object Content - { - get => (object)GetValue(ContentProperty); - set => SetValue(ContentProperty, value); - } - - /// - /// Identifies the Content dependency property. - /// - public static DependencyProperty ContentProperty { get; } = - DependencyProperty.Register(nameof(Content), typeof(object), typeof(InfoBar), new FrameworkPropertyMetadata(null)); - - /// - /// Gets or sets the data template for the InfoBar.Content. - /// - public DataTemplate ContentTemplate - { - get => (DataTemplate)GetValue(ContentTemplateProperty); - set => SetValue(ContentTemplateProperty, value); - } - - /// - /// Identifies the ContentTemplate dependency property. - /// - public static DependencyProperty ContentTemplateProperty { get; } = - DependencyProperty.Register(nameof(ContentTemplate), typeof(DataTemplate), typeof(InfoBar), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.ValueDoesNotInheritDataContext)); - - /// - /// Gets or sets the graphic content to appear alongside the title and message in the InfoBar. - /// - public IconSource IconSource - { - get => (IconSource)GetValue(IconSourceProperty); - set => SetValue(IconSourceProperty, value); - } - - /// - /// Identifies the IconSource dependency property. - /// - public static DependencyProperty IconSourceProperty { get; } = - DependencyProperty.Register(nameof(IconSource), typeof(IconSource), typeof(InfoBar), new FrameworkPropertyMetadata(null, OnIconSourcePropertyChanged)); - - /// - /// Identifies the IconSource dependency property. - /// - public bool IsClosable - { - get => (bool)GetValue(IsClosableProperty); - set => SetValue(IsClosableProperty, value); - } - - /// - /// Identifies the IsClosable dependency property. - /// - public static DependencyProperty IsClosableProperty { get; } = - DependencyProperty.Register(nameof(IsClosable), typeof(bool), typeof(InfoBar), new FrameworkPropertyMetadata(true, OnIsClosablePropertyChanged)); - - /// - /// Gets or sets a value that indicates whether the icon is visible in the InfoBar. - /// - public bool IsIconVisible - { - get => (bool)GetValue(IsIconVisibleProperty); - set => SetValue(IsIconVisibleProperty, value); - } - - /// - /// Identifies the IsIconVisible dependency property. - /// - public static DependencyProperty IsIconVisibleProperty { get; } = - DependencyProperty.Register(nameof(IsIconVisible), typeof(bool), typeof(InfoBar), new FrameworkPropertyMetadata(true, OnIsIconVisiblePropertyChanged)); - - /// - /// Gets or sets a value that indicates whether the InfoBar is open. - /// - public bool IsOpen - { - get => (bool)GetValue(IsOpenProperty); - set => SetValue(IsOpenProperty, value); - } - - /// - /// Identifies the IsOpen dependency property. - /// - public static DependencyProperty IsOpenProperty { get; } = - DependencyProperty.Register(nameof(IsOpen), typeof(bool), typeof(InfoBar), new FrameworkPropertyMetadata(false, OnIsOpenPropertyChanged)); - - /// - /// Gets or sets the message of the InfoBar. - /// - public string Message - { - get => (string)GetValue(MessageProperty); - set => SetValue(MessageProperty, value); - } - - /// - /// Identifies the Message dependency property. - /// - public static DependencyProperty MessageProperty { get; } = - DependencyProperty.Register(nameof(Message), typeof(string), typeof(InfoBar), new FrameworkPropertyMetadata(string.Empty)); - - /// - /// Gets or sets the type of the InfoBar to apply consistent status color, icon, - /// and assistive technology settings dependent on the criticality of the notification. - /// - public InfoBarSeverity Severity - { - get => (InfoBarSeverity)GetValue(SeverityProperty); - set => SetValue(SeverityProperty, value); - } - - /// - /// Identifies the Severity dependency property. - /// - public static DependencyProperty SeverityProperty { get; } = - DependencyProperty.Register(nameof(Severity), typeof(InfoBarSeverity), typeof(InfoBar), new FrameworkPropertyMetadata(InfoBarSeverity.Informational, OnSeverityPropertyChanged)); - - /// - /// Provides calculated values that can be referenced as TemplatedParent sources when defining templates for an InfoBar. - /// Not intended for general use. - /// - public InfoBarTemplateSettings TemplateSettings => (InfoBarTemplateSettings)GetValue(TemplateSettingsProperty); - - /// - /// Identifies the TemplateSettings dependency property. - /// - public static DependencyProperty TemplateSettingsProperty { get; } = - DependencyProperty.Register(nameof(TemplateSettings), typeof(InfoBarTemplateSettings), typeof(InfoBar), new FrameworkPropertyMetadata(null)); - - /// - /// Gets or sets the title of the InfoBar. - /// - public string Title - { - get => (string)GetValue(TitleProperty); - set => SetValue(TitleProperty, value); - } - - /// - /// Identifies the Title dependency property. - /// - public static DependencyProperty TitleProperty { get; } = - DependencyProperty.Register(nameof(Title), typeof(string), typeof(InfoBar), new FrameworkPropertyMetadata(string.Empty)); - - private static void OnIconSourcePropertyChanged( - DependencyObject sender, - DependencyPropertyChangedEventArgs args) - { - var owner = (InfoBar)sender; - owner.OnIconSourcePropertyChanged(args); - } - - private static void OnIsClosablePropertyChanged( - DependencyObject sender, - DependencyPropertyChangedEventArgs args) - { - var owner = (InfoBar)sender; - owner.OnIsClosablePropertyChanged(args); - } - - private static void OnIsIconVisiblePropertyChanged( - DependencyObject sender, - DependencyPropertyChangedEventArgs args) - { - var owner = (InfoBar)sender; - owner.OnIsIconVisiblePropertyChanged(args); - } - - private static void OnIsOpenPropertyChanged( - DependencyObject sender, - DependencyPropertyChangedEventArgs args) - { - var owner = (InfoBar)sender; - owner.OnIsOpenPropertyChanged(args); - } - - private static void OnSeverityPropertyChanged( - DependencyObject sender, - DependencyPropertyChangedEventArgs args) - { - var owner = (InfoBar)sender; - owner.OnSeverityPropertyChanged(args); - } + var owner = (InfoBar)sender; + owner.OnSeverityPropertyChanged(args); } } diff --git a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBar.cs b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBar.cs index d34c41cefba6..c5e20c45f13e 100644 --- a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBar.cs +++ b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBar.cs @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -// MUX reference InfoBar.cpp, commit ba45dbd +// MUX reference InfoBar.cpp, tag winui3/release/1.4.2 #pragma warning disable 105 // remove when moving to WinUI tree diff --git a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarAutomationPeer.cs b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarAutomationPeer.cs index deaa88992aa7..c565f55e4130 100644 --- a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarAutomationPeer.cs +++ b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarAutomationPeer.cs @@ -1,80 +1,73 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -// MUX reference InfoBarAutomationPeer.cpp, commit 3125489 +// MUX reference InfoBarAutomationPeer.cpp, tag winui3/release/1.4.2 using Microsoft.UI.Xaml.Controls; using Windows.UI.Xaml; using Windows.UI.Xaml.Automation.Peers; -namespace Microsoft.UI.Xaml.Automation.Peers +namespace Microsoft.UI.Xaml.Automation.Peers; + +/// +/// Exposes InfoBar types to Microsoft UI Automation. +/// +public partial class InfoBarAutomationPeer : FrameworkElementAutomationPeer { /// - /// Exposes InfoBar types to Microsoft UI Automation. + /// Initializes a new instance of the InfoBarAutomationPeer class. /// - public partial class InfoBarAutomationPeer : FrameworkElementAutomationPeer + /// The InfoBar control instance to create the peer for. + public InfoBarAutomationPeer(InfoBar owner) : base(owner) { - /// - /// Initializes a new instance of the InfoBarAutomationPeer class. - /// - /// The InfoBar control instance to create the peer for. - public InfoBarAutomationPeer(InfoBar owner) : base(owner) - { - } - - protected override AutomationControlType GetAutomationControlTypeCore() - { - return AutomationControlType.StatusBar; - } - - protected override string GetClassNameCore() - { - return nameof(InfoBar); - } + } - internal void RaiseOpenedEvent(InfoBarSeverity severity, string displayString) - { - //if (IAutomationPeer7 automationPeer7 = this) - { - this.RaiseNotificationEvent( - AutomationNotificationKind.Other, - GetProcessingForSeverity(severity), - displayString, - "InfoBarOpenedActivityId"); - } - } + protected override AutomationControlType GetAutomationControlTypeCore() + { + return AutomationControlType.StatusBar; + } - internal void RaiseClosedEvent(InfoBarSeverity severity, string displayString) - { - //AutomationNotificationProcessing processing = AutomationNotificationProcessing.CurrentThenMostRecent; + protected override string GetClassNameCore() + { + return nameof(InfoBar); + } - //if (IAutomationPeer7 automationPeer7 = this) - { - this.RaiseNotificationEvent( - AutomationNotificationKind.Other, - GetProcessingForSeverity(severity), - displayString, - "InfoBarClosedActivityId"); - } - } + internal void RaiseOpenedEvent(InfoBarSeverity severity, string displayString) + { + this.RaiseNotificationEvent( + AutomationNotificationKind.Other, + GetProcessingForSeverity(severity), + displayString, + "InfoBarOpenedActivityId"); + } + internal void RaiseClosedEvent(InfoBarSeverity severity, string displayString) + { + //AutomationNotificationProcessing processing = AutomationNotificationProcessing.CurrentThenMostRecent; - private AutomationNotificationProcessing GetProcessingForSeverity(InfoBarSeverity severity) - { - AutomationNotificationProcessing processing = AutomationNotificationProcessing.CurrentThenMostRecent; + this.RaiseNotificationEvent( + AutomationNotificationKind.Other, + GetProcessingForSeverity(severity), + displayString, + "InfoBarClosedActivityId"); + } - if (severity == InfoBarSeverity.Error - || severity == InfoBarSeverity.Warning) - { - processing = AutomationNotificationProcessing.ImportantAll; - } - return processing; - } + private AutomationNotificationProcessing GetProcessingForSeverity(InfoBarSeverity severity) + { + AutomationNotificationProcessing processing = AutomationNotificationProcessing.CurrentThenMostRecent; - private InfoBar GetInfoBar() + if (severity == InfoBarSeverity.Error + || severity == InfoBarSeverity.Warning) { - UIElement owner = Owner; - return (InfoBar)owner; + processing = AutomationNotificationProcessing.ImportantAll; } + + return processing; + } + + private InfoBar GetInfoBar() + { + UIElement owner = Owner; + return (InfoBar)owner; } } diff --git a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarCloseReason.cs b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarCloseReason.cs index 5e3fd6530922..325bd480d8ec 100644 --- a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarCloseReason.cs +++ b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarCloseReason.cs @@ -1,22 +1,21 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -// MUX reference InfoBar.idl, commit 3125489 +// MUX reference InfoBar.idl, tag winui3/release/1.4.2 -namespace Microsoft.UI.Xaml.Controls +namespace Microsoft.UI.Xaml.Controls; + +/// +/// Defines constants that indicate the cause of the InfoBar closure. +/// +public enum InfoBarCloseReason { /// - /// Defines constants that indicate the cause of the InfoBar closure. + /// The InfoBar was closed by the user clicking the close button. /// - public enum InfoBarCloseReason - { - /// - /// The InfoBar was closed by the user clicking the close button. - /// - CloseButton = 0, + CloseButton = 0, - /// - /// The InfoBar was programmatically closed. - /// - Programmatic = 1 - } + /// + /// The InfoBar was programmatically closed. + /// + Programmatic = 1 } diff --git a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarClosedEventArgs.cs b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarClosedEventArgs.cs index a118ff2c6d34..b096391acb60 100644 --- a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarClosedEventArgs.cs +++ b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarClosedEventArgs.cs @@ -1,21 +1,20 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -// MUX reference InfoBar.idl, commit 3125489 +// MUX reference InfoBar.idl, tag winui3/release/1.4.2 -namespace Microsoft.UI.Xaml.Controls +namespace Microsoft.UI.Xaml.Controls; + +/// +/// Provides data for the InfoBar.Closed event. +/// +public partial class InfoBarClosedEventArgs { + internal InfoBarClosedEventArgs(InfoBarCloseReason reason) => + Reason = reason; + /// - /// Provides data for the InfoBar.Closed event. + /// Gets a constant that specifies whether the cause of the Closed + /// event was due to user interaction (Close button click) or programmatic closure. /// - public partial class InfoBarClosedEventArgs - { - internal InfoBarClosedEventArgs(InfoBarCloseReason reason) => - Reason = reason; - - /// - /// Gets a constant that specifies whether the cause of the Closed - /// event was due to user interaction (Close button click) or programmatic closure. - /// - public InfoBarCloseReason Reason { get; } - } + public InfoBarCloseReason Reason { get; } } diff --git a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarClosingEventArgs.cs b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarClosingEventArgs.cs index bc217bd2359b..36b50679f375 100644 --- a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarClosingEventArgs.cs +++ b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarClosingEventArgs.cs @@ -1,26 +1,25 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -// MUX reference InfoBar.idl, commit 3125489 +// MUX reference InfoBar.idl, tag winui3/release/1.4.2 -namespace Microsoft.UI.Xaml.Controls +namespace Microsoft.UI.Xaml.Controls; + +/// +/// Provides data for the InfoBar.Closing event. +/// +public partial class InfoBarClosingEventArgs { + internal InfoBarClosingEventArgs(InfoBarCloseReason reason) => + Reason = reason; + /// - /// Provides data for the InfoBar.Closing event. + /// Gets a constant that specifies whether the cause of the Closing event + /// was due to user interaction (Close button click) or programmatic closure. /// - public partial class InfoBarClosingEventArgs - { - internal InfoBarClosingEventArgs(InfoBarCloseReason reason) => - Reason = reason; - - /// - /// Gets a constant that specifies whether the cause of the Closing event - /// was due to user interaction (Close button click) or programmatic closure. - /// - public InfoBarCloseReason Reason { get; } + public InfoBarCloseReason Reason { get; } - /// - /// Gets or sets a value that indicates whether the Closing event should be canceled in the InfoBar. - /// - public bool Cancel { get; set; } = false; - } + /// + /// Gets or sets a value that indicates whether the Closing event should be canceled in the InfoBar. + /// + public bool Cancel { get; set; } = false; } diff --git a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarPanel.Properties.cs b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarPanel.Properties.cs index 7d2c5127772e..554ce129e5bb 100644 --- a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarPanel.Properties.cs +++ b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarPanel.Properties.cs @@ -1,83 +1,82 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -// MUX reference InfoBarPanel.properties.cpp, commit 533c6b1 +// MUX reference InfoBarPanel.properties.cpp, tag winui3/release/1.4.2 using Windows.UI.Xaml; -namespace Microsoft.UI.Xaml.Controls.Primitives -{ - public partial class InfoBarPanel - { - /// - /// Gets the HorizontalOrientationMargin from an object. - /// - /// The object that has an HorizontalOrientationMargin. - /// The HorizontalOrientationMargin thickness. - public static Thickness GetHorizontalOrientationMargin(DependencyObject @object) => (Thickness)@object.GetValue(HorizontalOrientationMarginProperty); +namespace Microsoft.UI.Xaml.Controls.Primitives; - /// - /// Sets the HorizontalOrientationMargin to an object. - /// - /// The object that the HorizontalOrientationMargin value will be set to. - /// The thickness of the HorizontalOrientationMargin. - public static void SetHorizontalOrientationMargin(DependencyObject @object, Thickness value) => @object.SetValue(HorizontalOrientationMarginProperty, value); +public partial class InfoBarPanel +{ + /// + /// Gets the HorizontalOrientationMargin from an object. + /// + /// The object that has an HorizontalOrientationMargin. + /// The HorizontalOrientationMargin thickness. + public static Thickness GetHorizontalOrientationMargin(DependencyObject @object) => (Thickness)@object.GetValue(HorizontalOrientationMarginProperty); - /// - /// Gets the identifier for the HorizontalOrientationMargin dependency property. - /// - public static DependencyProperty HorizontalOrientationMarginProperty { get; } = - DependencyProperty.RegisterAttached("HorizontalOrientationMargin", typeof(Thickness), typeof(InfoBarPanel), new FrameworkPropertyMetadata(default(Thickness))); + /// + /// Sets the HorizontalOrientationMargin to an object. + /// + /// The object that the HorizontalOrientationMargin value will be set to. + /// The thickness of the HorizontalOrientationMargin. + public static void SetHorizontalOrientationMargin(DependencyObject @object, Thickness value) => @object.SetValue(HorizontalOrientationMarginProperty, value); - /// - /// Gets and sets the distance between the edges of the InfoBarPanel - /// and its children when the panel is oriented horizontally. - /// - public Thickness HorizontalOrientationPadding - { - get => (Thickness)GetValue(HorizontalOrientationPaddingProperty); - set => SetValue(HorizontalOrientationPaddingProperty, value); - } + /// + /// Gets the identifier for the HorizontalOrientationMargin dependency property. + /// + public static DependencyProperty HorizontalOrientationMarginProperty { get; } = + DependencyProperty.RegisterAttached("HorizontalOrientationMargin", typeof(Thickness), typeof(InfoBarPanel), new FrameworkPropertyMetadata(default(Thickness))); - /// - /// Gets the identifier for the HorizontalOrientationPadding dependency property. - /// - public static DependencyProperty HorizontalOrientationPaddingProperty { get; } = - DependencyProperty.Register(nameof(HorizontalOrientationPadding), typeof(Thickness), typeof(InfoBarPanel), new FrameworkPropertyMetadata(default(Thickness))); + /// + /// Gets and sets the distance between the edges of the InfoBarPanel + /// and its children when the panel is oriented horizontally. + /// + public Thickness HorizontalOrientationPadding + { + get => (Thickness)GetValue(HorizontalOrientationPaddingProperty); + set => SetValue(HorizontalOrientationPaddingProperty, value); + } - /// - /// Gets the VerticalOrientationMargin from an object. - /// - /// The object that has a VerticalOrientationMargin. - /// The VerticalOrientationMargin thickness. - public static Thickness GetVerticalOrientationMargin(DependencyObject @object) => (Thickness)@object.GetValue(VerticalOrientationMarginProperty); + /// + /// Gets the identifier for the HorizontalOrientationPadding dependency property. + /// + public static DependencyProperty HorizontalOrientationPaddingProperty { get; } = + DependencyProperty.Register(nameof(HorizontalOrientationPadding), typeof(Thickness), typeof(InfoBarPanel), new FrameworkPropertyMetadata(default(Thickness))); - /// - /// Sets the VerticalOrientationMargin to an object. - /// - /// The object that the VerticalOrientationMargin value will be set to. - /// The thickness of the VerticalOrientationMargin. - public static void SetVerticalOrientationMargin(DependencyObject @object, Thickness value) => @object.SetValue(VerticalOrientationMarginProperty, value); + /// + /// Gets the VerticalOrientationMargin from an object. + /// + /// The object that has a VerticalOrientationMargin. + /// The VerticalOrientationMargin thickness. + public static Thickness GetVerticalOrientationMargin(DependencyObject @object) => (Thickness)@object.GetValue(VerticalOrientationMarginProperty); - /// - /// Gets the identifier for the VerticalOrientationMargin dependency property. - /// - public static DependencyProperty VerticalOrientationMarginProperty { get; } = - DependencyProperty.RegisterAttached("VerticalOrientationMargin", typeof(Thickness), typeof(InfoBarPanel), new FrameworkPropertyMetadata(default(Thickness))); + /// + /// Sets the VerticalOrientationMargin to an object. + /// + /// The object that the VerticalOrientationMargin value will be set to. + /// The thickness of the VerticalOrientationMargin. + public static void SetVerticalOrientationMargin(DependencyObject @object, Thickness value) => @object.SetValue(VerticalOrientationMarginProperty, value); - /// - /// Gets and sets the distance between the edges of the InfoBarPanel - /// and its children when the panel is oriented vertically. - /// - public Thickness VerticalOrientationPadding - { - get => (Thickness)GetValue(VerticalOrientationPaddingProperty); - set => SetValue(VerticalOrientationPaddingProperty, value); - } + /// + /// Gets the identifier for the VerticalOrientationMargin dependency property. + /// + public static DependencyProperty VerticalOrientationMarginProperty { get; } = + DependencyProperty.RegisterAttached("VerticalOrientationMargin", typeof(Thickness), typeof(InfoBarPanel), new FrameworkPropertyMetadata(default(Thickness))); - /// - /// Gets the identifier for the VerticalOrientationPadding dependency property. - /// - public static DependencyProperty VerticalOrientationPaddingProperty { get; } = - DependencyProperty.Register(nameof(VerticalOrientationPadding), typeof(Thickness), typeof(InfoBarPanel), new FrameworkPropertyMetadata(default(Thickness))); + /// + /// Gets and sets the distance between the edges of the InfoBarPanel + /// and its children when the panel is oriented vertically. + /// + public Thickness VerticalOrientationPadding + { + get => (Thickness)GetValue(VerticalOrientationPaddingProperty); + set => SetValue(VerticalOrientationPaddingProperty, value); } + + /// + /// Gets the identifier for the VerticalOrientationPadding dependency property. + /// + public static DependencyProperty VerticalOrientationPaddingProperty { get; } = + DependencyProperty.Register(nameof(VerticalOrientationPadding), typeof(Thickness), typeof(InfoBarPanel), new FrameworkPropertyMetadata(default(Thickness))); } diff --git a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarPanel.cs b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarPanel.cs index fa16a93a3667..16c6e38c5447 100644 --- a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarPanel.cs +++ b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarPanel.cs @@ -1,181 +1,180 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -// MUX reference InfoBarPanel.cpp, commit d67e625 +// MUX reference InfoBarPanel.cpp, tag winui3/release/1.4.2 using System; using Windows.Foundation; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; -namespace Microsoft.UI.Xaml.Controls.Primitives +namespace Microsoft.UI.Xaml.Controls.Primitives; + +/// +/// Represents a panel that arranges its items horizontally if there is available space, otherwise vertically. +/// +public partial class InfoBarPanel : Panel { + private bool m_isVertical = false; + /// - /// Represents a panel that arranges its items horizontally if there is available space, otherwise vertically. + /// Initializes a new instance of the InfoBarPanel class. /// - public partial class InfoBarPanel : Panel + public InfoBarPanel() { - private bool m_isVertical = false; + } - /// - /// Initializes a new instance of the InfoBarPanel class. - /// - public InfoBarPanel() - { - } + protected override Size MeasureOverride(Size availableSize) + { + var desiredSize = new Size(); - protected override Size MeasureOverride(Size availableSize) - { - var desiredSize = new Size(); + double totalWidth = 0; + double totalHeight = 0; + double widthOfWidest = 0; + double heightOfTallest = 0; + double heightOfTallestInHorizontal = 0; + int nItems = 0; - double totalWidth = 0; - double totalHeight = 0; - double widthOfWidest = 0; - double heightOfTallest = 0; - double heightOfTallestInHorizontal = 0; - int nItems = 0; + var parent = this.Parent as FrameworkElement; + float minHeight = parent == null ? 0.0f : (float)(parent.MinHeight - (Margin.Top + Margin.Bottom)); - var parent = this.Parent as FrameworkElement; - float minHeight = parent == null ? 0.0f : (float)(parent.MinHeight - (Margin.Top + Margin.Bottom)); + var children = Children; + var childCount = (int)children.Count; + foreach (UIElement child in children) + { + child.Measure(availableSize); + var childDesiredSize = child.DesiredSize; - var children = Children; - var childCount = (int)children.Count; - foreach (UIElement child in children) + if (childDesiredSize.Width != 0 && childDesiredSize.Height != 0) { - child.Measure(availableSize); - var childDesiredSize = child.DesiredSize; - - if (childDesiredSize.Width != 0 && childDesiredSize.Height != 0) + // Add up the width of all items if they were laid out horizontally + var horizontalMargin = GetHorizontalOrientationMargin(child); + totalWidth += childDesiredSize.Width + (nItems > 0 ? (float)horizontalMargin.Left : 0) + (float)horizontalMargin.Right; + // Ignore left margin of first and right margin of last child + totalWidth += childDesiredSize.Width + + (nItems > 0 ? (float)horizontalMargin.Left : 0) + + (nItems < childCount - 1 ? (float)horizontalMargin.Right : 0); + + // Add up the height of all items if they were laid out vertically + var verticalMargin = GetVerticalOrientationMargin(child); + // Ignore top margin of first and bottom margin of last child + totalHeight += childDesiredSize.Height + + (nItems > 0 ? (float)verticalMargin.Top : 0) + + (nItems < childCount - 1 ? (float)verticalMargin.Bottom : 0); + + if (childDesiredSize.Width > widthOfWidest) { - // Add up the width of all items if they were laid out horizontally - var horizontalMargin = GetHorizontalOrientationMargin(child); - totalWidth += childDesiredSize.Width + (nItems > 0 ? (float)horizontalMargin.Left : 0) + (float)horizontalMargin.Right; - // Ignore left margin of first and right margin of last child - totalWidth += childDesiredSize.Width + - (nItems > 0 ? (float)horizontalMargin.Left : 0) + - (nItems < childCount - 1 ? (float)horizontalMargin.Right : 0); - - // Add up the height of all items if they were laid out vertically - var verticalMargin = GetVerticalOrientationMargin(child); - // Ignore top margin of first and bottom margin of last child - totalHeight += childDesiredSize.Height + - (nItems > 0 ? (float)verticalMargin.Top : 0) + - (nItems < childCount - 1 ? (float)verticalMargin.Bottom : 0); - - if (childDesiredSize.Width > widthOfWidest) - { - widthOfWidest = childDesiredSize.Width; - } - - if (childDesiredSize.Height > heightOfTallest) - { - heightOfTallest = childDesiredSize.Height; - } - - double childHeightInHorizontal = childDesiredSize.Height + horizontalMargin.Top + horizontalMargin.Bottom; - if (childHeightInHorizontal > heightOfTallestInHorizontal) - { - heightOfTallestInHorizontal = childHeightInHorizontal; - } + widthOfWidest = childDesiredSize.Width; + } - nItems++; + if (childDesiredSize.Height > heightOfTallest) + { + heightOfTallest = childDesiredSize.Height; } - } - // Since this panel is inside a *-sized grid column, availableSize.Width should not be infinite - // If there is only one item inside the panel, we will count it as vertical (the margins work out better that way) - // Also, if the height of any item is taller than the desired min height of the InfoBar, - // the items should be laid out vertically even though they may seem to fit due to text wrapping. - if (nItems == 1 || totalWidth > availableSize.Width || (minHeight > 0 && heightOfTallestInHorizontal > minHeight)) - { - m_isVertical = true; - var verticalPadding = VerticalOrientationPadding; + double childHeightInHorizontal = childDesiredSize.Height + horizontalMargin.Top + horizontalMargin.Bottom; + if (childHeightInHorizontal > heightOfTallestInHorizontal) + { + heightOfTallestInHorizontal = childHeightInHorizontal; + } - desiredSize.Width = widthOfWidest + (float)verticalPadding.Left + (float)verticalPadding.Right; - desiredSize.Height = totalHeight + (float)verticalPadding.Top + (float)verticalPadding.Bottom; + nItems++; } - else - { - m_isVertical = false; - var horizontalPadding = HorizontalOrientationPadding; + } - desiredSize.Width = totalWidth + (float)horizontalPadding.Left + (float)horizontalPadding.Right; - desiredSize.Height = heightOfTallest + (float)horizontalPadding.Top + (float)horizontalPadding.Bottom; - } + // Since this panel is inside a *-sized grid column, availableSize.Width should not be infinite + // If there is only one item inside the panel, we will count it as vertical (the margins work out better that way) + // Also, if the height of any item is taller than the desired min height of the InfoBar, + // the items should be laid out vertically even though they may seem to fit due to text wrapping. + if (nItems == 1 || totalWidth > availableSize.Width || (minHeight > 0 && heightOfTallestInHorizontal > minHeight)) + { + m_isVertical = true; + var verticalPadding = VerticalOrientationPadding; - return desiredSize; + desiredSize.Width = widthOfWidest + (float)verticalPadding.Left + (float)verticalPadding.Right; + desiredSize.Height = totalHeight + (float)verticalPadding.Top + (float)verticalPadding.Bottom; } + else + { + m_isVertical = false; + var horizontalPadding = HorizontalOrientationPadding; - protected override Size ArrangeOverride(Size finalSize) + desiredSize.Width = totalWidth + (float)horizontalPadding.Left + (float)horizontalPadding.Right; + desiredSize.Height = heightOfTallest + (float)horizontalPadding.Top + (float)horizontalPadding.Bottom; + } + + return desiredSize; + } + + protected override Size ArrangeOverride(Size finalSize) + { + Size result = finalSize; + + if (m_isVertical) { - Size result = finalSize; + // Layout elements vertically + var verticalOrientationPadding = VerticalOrientationPadding; + double verticalOffset = verticalOrientationPadding.Top; - if (m_isVertical) + bool hasPreviousElement = false; + foreach (UIElement child in Children) { - // Layout elements vertically - var verticalOrientationPadding = VerticalOrientationPadding; - double verticalOffset = verticalOrientationPadding.Top; - - bool hasPreviousElement = false; - foreach (UIElement child in Children) + var childAsFe = child as FrameworkElement; + if (childAsFe != null) { - var childAsFe = child as FrameworkElement; - if (childAsFe != null) + var desiredSize = child.DesiredSize; + if (desiredSize.Width != 0 && desiredSize.Height != 0) { - var desiredSize = child.DesiredSize; - if (desiredSize.Width != 0 && desiredSize.Height != 0) - { - var verticalMargin = GetVerticalOrientationMargin(child); + var verticalMargin = GetVerticalOrientationMargin(child); - verticalOffset += hasPreviousElement ? (float)verticalMargin.Top : 0; - child.Arrange(new Rect(verticalOrientationPadding.Left + verticalMargin.Left, verticalOffset, desiredSize.Width, desiredSize.Height)); - verticalOffset += desiredSize.Height + (float)verticalMargin.Bottom; + verticalOffset += hasPreviousElement ? (float)verticalMargin.Top : 0; + child.Arrange(new Rect(verticalOrientationPadding.Left + verticalMargin.Left, verticalOffset, desiredSize.Width, desiredSize.Height)); + verticalOffset += desiredSize.Height + (float)verticalMargin.Bottom; - hasPreviousElement = true; - } + hasPreviousElement = true; } } } - else - { - // Layout elements horizontally - var horizontalOrientationPadding = HorizontalOrientationPadding; - double horizontalOffset = horizontalOrientationPadding.Left; + } + else + { + // Layout elements horizontally + var horizontalOrientationPadding = HorizontalOrientationPadding; + double horizontalOffset = horizontalOrientationPadding.Left; - bool hasPreviousElement = false; + bool hasPreviousElement = false; - var children = Children; - var childCount = (int)children.Count; - for (int i = 0; i < childCount; i++) + var children = Children; + var childCount = (int)children.Count; + for (int i = 0; i < childCount; i++) + { + var child = children[i]; + var childAsFe = child as FrameworkElement; + if (childAsFe != null) { - var child = children[i]; - var childAsFe = child as FrameworkElement; - if (childAsFe != null) + var desiredSize = child.DesiredSize; + if (desiredSize.Width != 0 && desiredSize.Height != 0) { - var desiredSize = child.DesiredSize; - if (desiredSize.Width != 0 && desiredSize.Height != 0) + var horizontalMargin = GetHorizontalOrientationMargin(child); + + horizontalOffset += hasPreviousElement ? (float)horizontalMargin.Left : 0; + + if (i < childCount - 1) + { + child.Arrange(new Rect(horizontalOffset, (float)horizontalOrientationPadding.Top + (float)horizontalMargin.Top, desiredSize.Width, desiredSize.Height)); + } + else { - var horizontalMargin = GetHorizontalOrientationMargin(child); - - horizontalOffset += hasPreviousElement ? (float)horizontalMargin.Left : 0; - - if (i < childCount - 1) - { - child.Arrange(new Rect(horizontalOffset, (float)horizontalOrientationPadding.Top + (float)horizontalMargin.Top, desiredSize.Width, desiredSize.Height)); - } - else - { - // Give the rest of the horizontal space to the last child. - child.Arrange(new Rect(horizontalOffset, (float)horizontalOrientationPadding.Top + (float)horizontalMargin.Top, Math.Max(desiredSize.Width, finalSize.Width - horizontalOffset), desiredSize.Height)); - } - horizontalOffset += desiredSize.Width + (float)horizontalMargin.Right; - - hasPreviousElement = true; + // Give the rest of the horizontal space to the last child. + child.Arrange(new Rect(horizontalOffset, (float)horizontalOrientationPadding.Top + (float)horizontalMargin.Top, Math.Max(desiredSize.Width, finalSize.Width - horizontalOffset), desiredSize.Height)); } + horizontalOffset += desiredSize.Width + (float)horizontalMargin.Right; + + hasPreviousElement = true; } } } - - return result; } + + return result; } } diff --git a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarSeverity.cs b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarSeverity.cs index cd8597f9052a..21c955ebb829 100644 --- a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarSeverity.cs +++ b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarSeverity.cs @@ -1,42 +1,41 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -// MUX reference InfoBar.idl, commit 3125489 +// MUX reference InfoBar.idl, tag winui3/release/1.4.2 -namespace Microsoft.UI.Xaml.Controls +namespace Microsoft.UI.Xaml.Controls; + +/// +/// Defines constants that indicate the criticality of the InfoBar that is shown. +/// +public enum InfoBarSeverity { /// - /// Defines constants that indicate the criticality of the InfoBar that is shown. + /// Communicates that the InfoBar is displaying general information that + /// requires the user's attention. For assistive technologies, they will + /// follow the behavior set in the Processing_All constant. /// - public enum InfoBarSeverity - { - /// - /// Communicates that the InfoBar is displaying general information that - /// requires the user's attention. For assistive technologies, they will - /// follow the behavior set in the Processing_All constant. - /// - Informational = 0, + Informational = 0, - /// - /// Communicates that the InfoBar is displaying information regarding - /// a long-running and/or background task that has completed successfully. - /// For assistive technologies, they will follow the behavior - /// set in the Processing_All constant. - /// - Success = 1, + /// + /// Communicates that the InfoBar is displaying information regarding + /// a long-running and/or background task that has completed successfully. + /// For assistive technologies, they will follow the behavior + /// set in the Processing_All constant. + /// + Success = 1, - /// - /// Communicates that the InfoBar is displaying information regarding - /// a condition that might cause a problem in the future. For assistive - /// technologies, they will follow the behavior - /// set in the NotificationProcessing_ImportantAll constant. - /// - Warning = 2, + /// + /// Communicates that the InfoBar is displaying information regarding + /// a condition that might cause a problem in the future. For assistive + /// technologies, they will follow the behavior + /// set in the NotificationProcessing_ImportantAll constant. + /// + Warning = 2, - /// - /// Communicates that the InfoBar is displaying information regarding an error - /// or problem that has occurred. For assistive technologies, they will follow - /// the behavior set in the NotificationProcessing_ImportantAll constant. - /// - Error = 3, - } + /// + /// Communicates that the InfoBar is displaying information regarding an error + /// or problem that has occurred. For assistive technologies, they will follow + /// the behavior set in the NotificationProcessing_ImportantAll constant. + /// + Error = 3, } diff --git a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarTemplateSettings.cs b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarTemplateSettings.cs index c8407efb5cf4..58f352f0a887 100644 --- a/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarTemplateSettings.cs +++ b/src/Uno.UI/Microsoft/UI/Xaml/Controls/InfoBar/InfoBarTemplateSettings.cs @@ -1,38 +1,37 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. -// MUX reference InfoBarTemplateSettings.properties.cpp, commit 3125489 +// MUX reference InfoBarTemplateSettings.properties.cpp, tag winui3/release/1.4.2 using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; -namespace Microsoft.UI.Xaml.Controls +namespace Microsoft.UI.Xaml.Controls; + +/// +/// Provides calculated values that can be referenced as TemplatedParent +/// sources when defining templates for an InfoBar. +/// +public partial class InfoBarTemplateSettings : DependencyObject { /// - /// Provides calculated values that can be referenced as TemplatedParent - /// sources when defining templates for an InfoBar. + /// Initializes a new instance of the InfoBarTemplateSettings class. /// - public partial class InfoBarTemplateSettings : DependencyObject + public InfoBarTemplateSettings() { - /// - /// Initializes a new instance of the InfoBarTemplateSettings class. - /// - public InfoBarTemplateSettings() - { - } - - /// - /// Gets the icon element. - /// - public IconElement IconElement - { - get => (IconElement)GetValue(IconElementProperty); - set => SetValue(IconElementProperty, value); - } + } - /// - /// Identifies the InfoBarTemplateSettings.IconElement dependency property. - /// - public static DependencyProperty IconElementProperty { get; } = - DependencyProperty.Register(nameof(IconElement), typeof(IconElement), typeof(InfoBarTemplateSettings), new FrameworkPropertyMetadata(null)); + /// + /// Gets the icon element. + /// + public IconElement IconElement + { + get => (IconElement)GetValue(IconElementProperty); + set => SetValue(IconElementProperty, value); } + + /// + /// Identifies the InfoBarTemplateSettings.IconElement dependency property. + /// + public static DependencyProperty IconElementProperty { get; } = + DependencyProperty.Register(nameof(IconElement), typeof(IconElement), typeof(InfoBarTemplateSettings), new FrameworkPropertyMetadata(null)); }