Skip to content

This example demonstrates about how to create the application using C# with .NET MAUI Expander (SfExpander).

SyncfusionExamples/create-application-using-C--with-.net-maui-expander

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

create-application-using-C--with-.net-maui-expander

This article will guide you, how to create the Expander using C# with .NET MAUI Expander (SfExpander).

Refer the below demo to create expander,

C#

public partial class MainPage : ContentPage
{
   StackLayout stack;
   SfExpander expander1, expander2;
   
   public MainPage()
   {
       InitializeComponent();

       stack = new StackLayout();
       // Expander 1
       expander1 = new SfExpander();
       // Expander header view
       var header1 = new Grid()
       {
           HeightRequest = 40
       };
       var headerLabel = new Label()
       {
           HorizontalTextAlignment = TextAlignment.Start,
           VerticalTextAlignment = TextAlignment.Center,
           Text = "Veg Pizza",

       };
       header1.Children.Add(headerLabel);
       expander1.Header = header1;

       // Expander content view
       var content1 = new Grid()
       {
           HeightRequest = 60
       };

       var contentLabel = new Label()
       {
           HorizontalTextAlignment = TextAlignment.Start,
           VerticalTextAlignment = TextAlignment.Center,
           HeightRequest = 60,
           Text = "Veg pizza is prepared with the items that meet vegetarian standards by not including any meat or animal tissue products.",
       };

       content1.Children.Add(contentLabel);
       expander1.Content = content1;

       // Expander 2
       expander2 = new SfExpander();
       // Expander header view
       var header2 = new Grid()
       {
           HeightRequest = 40
       };
       var headerLabel2 = new Label()
       {
           Text = "Non- Veg Pizza",
           HorizontalTextAlignment = TextAlignment.Start,
           VerticalTextAlignment = TextAlignment.Center,
       };
       header2.Children.Add(headerLabel2);
       expander2!.Header = header2;

       // Expander content view
       var content2 = new Grid()
       {
           HeightRequest = 60
       };

       var contentLabel2 = new Label()
       {
           HeightRequest = 60,
           Text = "Non-veg pizza is prepared by including the meat and animal tissue products.",
           VerticalTextAlignment = TextAlignment.Center,
           HorizontalTextAlignment = TextAlignment.Start,
       };
       content2.Children.Add(contentLabel2);
       expander2!.Content = content2;

       stack.Children.Add(expander1);
       stack.Children.Add(expander2);
       this.Content = stack;
   }
}

About

This example demonstrates about how to create the application using C# with .NET MAUI Expander (SfExpander).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 6

Languages