Skip to content

Commit 9cff476

Browse files
committed
Fixing orientation handling
1 parent 95eb2e6 commit 9cff476

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

Fluent.Ribbon/Controls/RibbonGroupBoxWrapPanel.cs

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,6 @@ namespace Fluent;
1313
/// </summary>
1414
public class RibbonGroupBoxWrapPanel : Panel
1515
{
16-
private const Orientation DefaultOrientation = Orientation.Vertical;
17-
18-
private Orientation orientation;
19-
20-
/// <summary>
21-
/// Creates a new instance.
22-
/// </summary>
23-
public RibbonGroupBoxWrapPanel()
24-
{
25-
this.orientation = DefaultOrientation;
26-
}
27-
2816
/// <summary>
2917
/// Attached <see cref="DependencyProperty"/> for <c>SharedSizeGroupName</c>.
3018
/// </summary>
@@ -155,7 +143,7 @@ public double ItemHeight
155143
public static readonly DependencyProperty OrientationProperty =
156144
StackPanel.OrientationProperty.AddOwner(
157145
typeof(RibbonGroupBoxWrapPanel),
158-
new FrameworkPropertyMetadata(Orientation.Horizontal,
146+
new FrameworkPropertyMetadata(Orientation.Vertical,
159147
FrameworkPropertyMetadataOptions.AffectsMeasure,
160148
OnOrientationChanged));
161149

@@ -168,17 +156,20 @@ public double ItemHeight
168156
/// </summary>
169157
public Orientation Orientation
170158
{
171-
get { return this.orientation; }
159+
get { return (Orientation)this.GetValue(OrientationProperty); }
172160
set { this.SetValue(OrientationProperty, value); }
173161
}
174162

175-
/// <summary>
176-
/// <see cref="PropertyMetadata.PropertyChangedCallback"/>
177-
/// </summary>
178163
private static void OnOrientationChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
179164
{
180-
var p = (RibbonGroupBoxWrapPanel)d;
181-
p.orientation = (Orientation)e.NewValue;
165+
var control = (RibbonGroupBoxWrapPanel)d;
166+
167+
if (control.IsLoaded is false)
168+
{
169+
return;
170+
}
171+
172+
UIHelper.GetParent<RibbonGroupBox>(control)?.TryClearCacheAndResetStateAndScaleAndNotifyParentRibbonGroupsContainer();
182173
}
183174

184175
private struct UvSize

0 commit comments

Comments
 (0)