Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port microsoft/microsoft-ui-xaml#3431 #615

Merged
merged 1 commit into from
Nov 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ModernWpf.Controls/AutoSuggestBox/AutoSuggestBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
xmlns:primitives="clr-namespace:ModernWpf.Controls.Primitives">

<Style TargetType="local:AutoSuggestBox">
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Top"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="IsTabStop" Value="False" />
Expand Down
3 changes: 2 additions & 1 deletion ModernWpf.Controls/NumberBox/NumberBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
<Setter Property="BorderThickness" Value="{DynamicResource TextControlBorderThemeThickness}"/>
<Setter Property="BorderBrush" Value="{DynamicResource TextControlBorderBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource TextControlBorderBrush}" />
<Setter Property="Padding" Value="{DynamicResource TextControlThemePadding}" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Template">
<Setter.Value>
Expand Down
3 changes: 2 additions & 1 deletion ModernWpf/Styles/RichTextBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False" />
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
<Setter Property="MinWidth" Value="{DynamicResource TextControlThemeMinWidth}" />
<Setter Property="Padding" Value="{DynamicResource TextControlThemePadding}" />
<Setter Property="primitives:ControlHelper.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
<Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
Expand Down Expand Up @@ -60,7 +61,7 @@
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding primitives:ControlHelper.CornerRadius}"
MinWidth="{DynamicResource TextControlThemeMinWidth}"
MinWidth="{TemplateBinding MinWidth}"
MinHeight="{DynamicResource TextControlThemeMinHeight}"
primitives:ValidationHelper.IsTemplateValidationAdornerSite="True" />
<ScrollViewer
Expand Down
9 changes: 7 additions & 2 deletions test/ModernWpfTestApp/ApiTests/AutoSuggestBoxTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@ public void VerifyAutoSuggestBoxCornerRadius()
autoSuggestBox.CornerRadius = new CornerRadius(2);
autoSuggestBox.Focus(/*FocusState.Keyboard*/);
autoSuggestBox.Text = "123";
autoSuggestBox.MaxHeight = 32;
});
IdleSynchronizer.Wait();

RunOnUIThread.Execute(() =>
{
var textBox = TestUtilities.FindDescendents<TextBox>(autoSuggestBox).Where(e => e.Name == "TextBox").Single();
Verify.AreEqual(new CornerRadius(2, 2, 0, 0), textBox.GetCornerRadius());

// Flyout might open differently and as such flip corner radii values
Verify.IsTrue(new CornerRadius(2, 2, 0, 0) == textBox.GetCornerRadius() || new CornerRadius(0, 0, 2, 2) == textBox.GetCornerRadius());

var overlayCornerRadius = new CornerRadius(0, 0, 0, 0);
var radius = App.Current.Resources["OverlayCornerRadius"];
Expand All @@ -60,7 +63,9 @@ public void VerifyAutoSuggestBoxCornerRadius()
var popup = VisualTreeHelperEx.GetOpenPopups(WindowEx.Current).Last();
var popupBorder = TestUtilities.FindDescendents<Border>(popup).First();

Verify.AreEqual(new CornerRadius(0, 0, overlayCornerRadius.BottomRight, overlayCornerRadius.BottomLeft), popupBorder.CornerRadius);
// Flyout might open differently and as such flip corner radii values
Verify.IsTrue(new CornerRadius(0, 0, overlayCornerRadius.BottomRight, overlayCornerRadius.BottomLeft) == popupBorder.CornerRadius
|| new CornerRadius(overlayCornerRadius.TopRight, overlayCornerRadius.TopLeft, 0, 0) == popupBorder.CornerRadius);
});
}

Expand Down
10 changes: 10 additions & 0 deletions test/ModernWpfTestApp/NumberBoxPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,16 @@
<controls:NumberBox x:Name="HeaderTemplateTestingNumberBox"/>
</StackPanel>

<!-- FontSize propagation -->
<controls:NumberBox Header="Header text" FontSize="50"/>

<StackPanel Orientation="Horizontal" Height="50">
<controls:NumberBox PlaceholderText="Number"/>
<TextBoxEx PlaceholderText="Text"/>
<controls:AutoSuggestBox PlaceholderText="Auto"/>
<RichEditBox PlaceholderText="Rich" Style="{StaticResource DefaultRichTextBoxStyle}"/>
</StackPanel>

<!-- Property propagation -->
<StackPanel Orientation="Horizontal">
<TextBoxEx Header="Header text" FontSize="14" Foreground="{ThemeResource SystemControlForegroundAccentBrush}"
Expand Down
Loading