Skip to content

Border and Shadow Issue in MAUI Application #30341

Open
@VengadeshSF4855

Description

@VengadeshSF4855

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;
`

Image

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.

Image

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

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-controls-borderBorderarea-drawingShapes, Borders, Shadows, Graphics, BoxView, custom drawingpartner/syncfusionIssues / PR's with Syncfusion collaborationplatform/windowss/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions