Skip to content
Draft
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue17414.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
namespace Maui.Controls.Sample.Issues;

[Issue(IssueTracker.Github, 17414, "Default styling for controls does not work", PlatformAffected.UWP)]
public partial class Issue17414Shell : Shell
{
public Issue17414Shell()
{
FlyoutBehavior = FlyoutBehavior.Flyout;
ItemTemplate = new DataTemplate(() =>
{
return new Label
{
Margin = new Thickness(20),
Text = "Home"
};
});

var detailContentPage = new ContentPage
{
BackgroundColor = Colors.LightGreen,
Content = new Label
{
AutomationId = "MainPageLabel",
Text = "Verify that the flyout content has no default corner radius",
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center
}
};

Items.Add(new ShellContent
{
Content = detailContentPage
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues;

public class Issue17414 : _IssuesUITest
{
public override string Issue => "Default styling for controls does not work";

public Issue17414(TestDevice device)
: base(device)
{ }

[Test]
[Category(UITestCategories.FlyoutPage)]
[Category(UITestCategories.Shell)]
public void VerifyFlyoutContentHasNoDefaultCornerRadius()
{
App.WaitForElement("MainPageLabel");
App.TapShellFlyoutIcon();
VerifyScreenshot();
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/Core/src/Platform/Windows/MauiNavigationView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ protected override void OnApplyTemplate()
// It causes the content to not be flush up against the title bar
PaneContentGrid.Margin = new WThickness(0, 0, 0, 0);
UpdateMenuItemsContainerHeight();
RootSplitView.CornerRadius = new UI.Xaml.CornerRadius(0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be possible to apply the fix in the NavigationView Resources?

This is the margin around the NavigationView.Header. By default WinUI will set a

In that way, developers that would like to keep the previous behavior or override it, can do easily just creating single resources and not require to override classes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsuarezruiz, Thank you for the suggestion! After investigating WinUI's NavigationView template, I found that RootSplitView uses the OverlayCornerRadius resource key directly, and changing this global key would affect all overlay scenarios. Since there's no specific resource key for NavigationView's RootSplitView CornerRadius, the C# approach ensures we only target our specific NavigationView instance without impacting other UI elements.

CornerRadius = new UI.Xaml.CornerRadius(0);

// On WinAppSDK 1.7, it seems that if the PaneContentGrid width is not explicitly set,
// it takes on the desired width of its child.
Expand Down