How do I add a frame in C# code behind?

Platform: .NET MAUI| Category: General

You can create and add a frame in C# code-behind as follows:
C#

public MainPage()
      {
	   InitializeComponent();
          var frame = new Frame 
          {
            CornerRadius = 5,
            WidthRequest = 100,
            HeightRequest = 100,
            BorderColor = Colors.Black,
            HasShadow = true,
            BackgroundColor = Colors.Red,   
            Content = new Label { Text = "Hello, World!"},
           };
          Content = frame;
      }

Share with

Related FAQs

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

Please submit your question and answer.