Description
Description
We are experiencing difficulties with setting the border and shadow in MAUI application. The border is not aligning properly — there are white spaces next to it, indicating that it is not set at the edges correctly. Additionally, we are unable to set the shadow effectively.
Included below code in MauiProgram.cs
`
var rootElement = window.Content as Microsoft.UI.Xaml.FrameworkElement;
var grid = new Microsoft.UI.Xaml.Controls.Grid
{
Background = new Microsoft.UI.Xaml.Media.SolidColorBrush(Microsoft.UI.Colors.Transparent),
Padding = new Microsoft.UI.Xaml.Thickness(1)
};
var border = new Microsoft.UI.Xaml.Controls.Border
{
BorderBrush = new Microsoft.UI.Xaml.Media.SolidColorBrush(Microsoft.UI.Colors.LightGray),
BorderThickness = new Microsoft.UI.Xaml.Thickness(1),
Background = new Microsoft.UI.Xaml.Media.SolidColorBrush(Microsoft.UI.Colors.White),
Child = rootElement,
CornerRadius = new Microsoft.UI.Xaml.CornerRadius(4),
};
grid.Children.Add(border);
window.Content = grid;
`
Approach 2 - Tried to give shadow by wrapping content inside the border.
we created a new content page and included a header, body, and footer within a border. We have applied a shadow to this border. However, we are encountering an issue where there is an unexpected white space above the header, and the shadow effect is only appearing at the top region, not surrounding the entire border as intended.
Steps to Reproduce
No response
Link to public reproduction project repository
No response
Version with bug
10.0.0-preview.5
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
No response
Affected platforms
Windows
Affected platform versions
No response
Did you find any workaround?
No response