@@ -71,14 +71,32 @@ public bool IsContextual
71
71
new PropertyMetadata ( HorizontalAlignment . Left ) ) ;
72
72
73
73
/// <summary>
74
- /// Gets or sets a value indicating whether this tab is contextual .
74
+ /// Gets or sets a value indicating the alignment of the command overflow button .
75
75
/// </summary>
76
76
public HorizontalAlignment OverflowButtonAlignment
77
77
{
78
78
get => ( HorizontalAlignment ) GetValue ( OverflowButtonAlignmentProperty ) ;
79
79
set => SetValue ( OverflowButtonAlignmentProperty , value ) ;
80
80
}
81
81
82
+ /// <summary>
83
+ /// Identifies the <see cref="CommandAlignment"/> property.
84
+ /// </summary>
85
+ public static readonly DependencyProperty CommandAlignmentProperty = DependencyProperty . Register (
86
+ nameof ( CommandAlignment ) ,
87
+ typeof ( HorizontalAlignment ) ,
88
+ typeof ( TabbedCommandBarItem ) ,
89
+ new PropertyMetadata ( HorizontalAlignment . Stretch ) ) ;
90
+
91
+ /// <summary>
92
+ /// Gets or sets a value indicating the alignment of the commands in the <see cref="TabbedCommandBarItem"/>.
93
+ /// </summary>
94
+ public HorizontalAlignment CommandAlignment
95
+ {
96
+ get => ( HorizontalAlignment ) GetValue ( CommandAlignmentProperty ) ;
97
+ set => SetValue ( CommandAlignmentProperty , value ) ;
98
+ }
99
+
82
100
/// <inheritdoc/>
83
101
protected override void OnApplyTemplate ( )
84
102
{
@@ -87,13 +105,21 @@ protected override void OnApplyTemplate()
87
105
_primaryItemsControl = GetTemplateChild ( "PrimaryItemsControl" ) as ItemsControl ;
88
106
if ( _primaryItemsControl != null )
89
107
{
90
- _primaryItemsControl . HorizontalAlignment = HorizontalAlignment . Stretch ;
108
+ _primaryItemsControl . HorizontalAlignment = CommandAlignment ;
109
+ RegisterPropertyChangedCallback ( CommandAlignmentProperty , ( sender , dp ) =>
110
+ {
111
+ _primaryItemsControl . HorizontalAlignment = ( HorizontalAlignment ) sender . GetValue ( dp ) ;
112
+ } ) ;
91
113
}
92
114
93
115
_moreButton = GetTemplateChild ( "MoreButton" ) as Button ;
94
116
if ( _moreButton != null )
95
117
{
96
118
_moreButton . HorizontalAlignment = OverflowButtonAlignment ;
119
+ RegisterPropertyChangedCallback ( OverflowButtonAlignmentProperty , ( sender , dp ) =>
120
+ {
121
+ _moreButton . HorizontalAlignment = ( HorizontalAlignment ) sender . GetValue ( dp ) ;
122
+ } ) ;
97
123
}
98
124
}
99
125
}
0 commit comments