How can I create a border programmatically in C# code?

Platform: .NET MAUI| Category: General

You can create a border programmatically in C# code like this:

C#:

var myBorder = new Border
{

    HeightRequest = 200,
    WidthRequest = 200,
    Stroke = Colors.Red,
    Padding = new Thickness(10),
    Content = new Label { Text = "Hello, Border!" }
};
Content = myBorder;

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.