-
Notifications
You must be signed in to change notification settings - Fork 751
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Update AppBarSeparator to winui3/release/1.6.4
- Loading branch information
1 parent
0ca970c
commit 90c983d
Showing
5 changed files
with
155 additions
and
149 deletions.
There are no files selected for viewing
67 changes: 0 additions & 67 deletions
67
src/Uno.UI/UI/Xaml/Controls/AppBar/AppBarSeparator.Partial.cs
This file was deleted.
Oops, something went wrong.
159 changes: 78 additions & 81 deletions
159
src/Uno.UI/UI/Xaml/Controls/AppBar/AppBarSeparator.Properties.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,95 +1,92 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Microsoft.UI.Xaml; | ||
using Microsoft.UI.Xaml.Controls; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
// MUX Reference dxaml\xcp\dxaml\lib\AppBarSeparator_Partial.cpp, tag winui3/release/1.6.4, commit 262a901e09 | ||
|
||
namespace Microsoft.UI.Xaml.Controls | ||
namespace Microsoft.UI.Xaml.Controls; | ||
|
||
partial class AppBarSeparator | ||
{ | ||
partial class AppBarSeparator | ||
/// <summary> | ||
/// Gets or sets the order in which this item is moved to the CommandBar overflow menu. | ||
/// </summary> | ||
public int DynamicOverflowOrder | ||
{ | ||
#region IsCompat | ||
|
||
public bool IsCompact | ||
{ | ||
get => (bool)this.GetValue(IsCompactProperty); | ||
set => this.SetValue(IsCompactProperty, value); | ||
} | ||
get => (int)GetValue(DynamicOverflowOrderProperty); | ||
set => SetValue(DynamicOverflowOrderProperty, value); | ||
} | ||
|
||
public static DependencyProperty IsCompactProperty { get; } = | ||
/// <summary> | ||
/// Identifies the DynamicOverflowOrder dependency property. | ||
/// </summary> | ||
public static DependencyProperty DynamicOverflowOrderProperty { get; } = | ||
DependencyProperty.Register( | ||
"IsCompact", | ||
typeof(bool), | ||
nameof(DynamicOverflowOrder), | ||
typeof(int), | ||
typeof(AppBarSeparator), | ||
new FrameworkPropertyMetadata(default(bool)) | ||
); | ||
|
||
#endregion | ||
|
||
#region DynamicOverflowOrder | ||
|
||
public int DynamicOverflowOrder | ||
{ | ||
get => (int)this.GetValue(DynamicOverflowOrderProperty); | ||
set => this.SetValue(DynamicOverflowOrderProperty, value); | ||
} | ||
new FrameworkPropertyMetadata(default(int))); | ||
|
||
public static DependencyProperty DynamicOverflowOrderProperty { get; } = | ||
DependencyProperty.Register( | ||
"DynamicOverflowOrder", | ||
typeof(int), | ||
typeof(AppBarSeparator), | ||
new FrameworkPropertyMetadata(default(int)) | ||
); | ||
|
||
#endregion | ||
|
||
#region IsInOverflow | ||
|
||
public bool IsInOverflow | ||
{ | ||
get => CommandBar.IsCommandBarElementInOverflow(this); | ||
internal set => this.SetValue(IsInOverflowProperty, value); | ||
} | ||
|
||
bool ICommandBarElement3.IsInOverflow | ||
{ | ||
get => IsInOverflow; | ||
set => IsInOverflow = value; | ||
} | ||
|
||
public static DependencyProperty IsInOverflowProperty { get; } = | ||
DependencyProperty.Register( | ||
"IsInOverflow", | ||
typeof(bool), | ||
typeof(AppBarSeparator), | ||
new FrameworkPropertyMetadata(default(bool)) | ||
); | ||
|
||
#endregion | ||
/// <summary> | ||
/// Gets or sets a value that indicates whether the separator is shown with reduced padding. | ||
/// </summary> | ||
public bool IsCompact | ||
{ | ||
get => (bool)GetValue(IsCompactProperty); | ||
set => SetValue(IsCompactProperty, value); | ||
} | ||
|
||
#region UseOverflowStyle | ||
/// <summary> | ||
/// Identifies the IsCompact dependency property. | ||
/// </summary> | ||
public static DependencyProperty IsCompactProperty { get; } = | ||
DependencyProperty.Register( | ||
nameof(IsCompact), | ||
typeof(bool), | ||
typeof(AppBarSeparator), | ||
new FrameworkPropertyMetadata(default(bool)) | ||
); | ||
|
||
/// <summary> | ||
/// Gets a value that indicates whether this item is in the overflow menu. | ||
/// </summary> | ||
public bool IsInOverflow | ||
{ | ||
get => CommandBar.IsCommandBarElementInOverflow(this); | ||
private set => SetValue(IsInOverflowProperty, value); | ||
} | ||
|
||
internal bool UseOverflowStyle | ||
{ | ||
get => (bool)this.GetValue(UseOverflowStyleProperty); | ||
set => this.SetValue(UseOverflowStyleProperty, value); | ||
} | ||
/// <summary> | ||
/// Identifies the IsInOverflow dependency property. | ||
/// </summary> | ||
public static DependencyProperty IsInOverflowProperty { get; } = | ||
DependencyProperty.Register( | ||
nameof(IsInOverflow), | ||
typeof(bool), | ||
typeof(AppBarSeparator), | ||
new FrameworkPropertyMetadata(default(bool))); | ||
|
||
bool ICommandBarOverflowElement.UseOverflowStyle | ||
{ | ||
get => UseOverflowStyle; | ||
set => UseOverflowStyle = value; | ||
} | ||
bool ICommandBarElement3.IsInOverflow | ||
{ | ||
get => IsInOverflow; | ||
set => IsInOverflow = value; | ||
} | ||
|
||
internal static DependencyProperty UseOverflowStyleProperty { get; } = | ||
DependencyProperty.Register( | ||
nameof(UseOverflowStyle), | ||
typeof(bool), | ||
typeof(AppBarSeparator), | ||
new FrameworkPropertyMetadata(default(bool)) | ||
); | ||
internal bool UseOverflowStyle | ||
{ | ||
get => (bool)GetValue(UseOverflowStyleProperty); | ||
set => SetValue(UseOverflowStyleProperty, value); | ||
} | ||
|
||
#endregion | ||
bool ICommandBarOverflowElement.UseOverflowStyle | ||
{ | ||
get => UseOverflowStyle; | ||
set => UseOverflowStyle = value; | ||
} | ||
|
||
internal static DependencyProperty UseOverflowStyleProperty { get; } = | ||
DependencyProperty.Register( | ||
nameof(UseOverflowStyle), | ||
typeof(bool), | ||
typeof(AppBarSeparator), | ||
new FrameworkPropertyMetadata(default(bool)) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace Microsoft.UI.Xaml.Controls; | ||
|
||
/// <summary> | ||
/// Represents a line that separates items in an AppBar or CommandBar. | ||
/// </summary> | ||
public partial class AppBarSeparator : Control, ICommandBarElement, ICommandBarElement2, ICommandBarElement3, ICommandBarOverflowElement | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the AppBarSeparator class. | ||
/// </summary> | ||
public AppBarSeparator() | ||
{ | ||
DefaultStyleKey = typeof(AppBarSeparator); | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
src/Uno.UI/UI/Xaml/Controls/AppBar/AppBarSeparator.partial.mux.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
// MUX Reference dxaml\xcp\dxaml\lib\AppBarSeparator_Partial.cpp, tag winui3/release/1.6.4, commit 262a901e09 | ||
|
||
#nullable enable | ||
|
||
namespace Microsoft.UI.Xaml.Controls; | ||
|
||
public partial class AppBarSeparator : Control, ICommandBarElement, ICommandBarElement2, ICommandBarElement3, ICommandBarOverflowElement | ||
{ | ||
internal override void OnPropertyChanged2(DependencyPropertyChangedEventArgs args) | ||
{ | ||
base.OnPropertyChanged2(args); | ||
|
||
if (args.Property == IsCompactProperty || | ||
args.Property == UseOverflowStyleProperty) | ||
{ | ||
UpdateVisualState(); | ||
} | ||
} | ||
|
||
// After template is applied, set the initial view state | ||
// (FullSize or Compact) based on the value of our | ||
// IsCompact property | ||
protected override void OnApplyTemplate() | ||
{ | ||
base.OnApplyTemplate(); | ||
|
||
UpdateVisualState(); | ||
} | ||
|
||
// Sets the visual state to "Compact" or "FullSize" based on the value | ||
// of our IsCompact property | ||
private protected override void ChangeVisualState(bool useTransitions) | ||
{ | ||
base.ChangeVisualState(useTransitions); | ||
|
||
var useOverflowStyle = UseOverflowStyle; | ||
var isCompact = IsCompact; | ||
|
||
if (useOverflowStyle) | ||
{ | ||
GoToState(useTransitions, "Overflow"); | ||
} | ||
else if (isCompact) | ||
{ | ||
GoToState(useTransitions, "Compact"); | ||
} | ||
else | ||
{ | ||
GoToState(useTransitions, "FullSize"); | ||
} | ||
} | ||
|
||
private protected override void OnVisibilityChanged() => | ||
CommandBar.OnCommandBarElementVisibilityChanged(this); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters