Git Product home page Git Product logo

expander-c-xamarin's Introduction

How to work with Expander using C# in Xamarin.Forms (SfExpander)

You can create the SfExpander using the C# in Xamarin.Forms.

You can also refer the following article.

https://www.syncfusion.com/kb/11367/how-to-work-with-expander-using-c-in-xamarin-forms-sfexpander

C#

Creating the SfExpander in the constructor of the MainPage.

public partial class MainPage : ContentPage
{
    SfExpander expander, expander2;
    ScrollView scrollView;
    StackLayout stack;
    public MainPage()
    {
        InitializeComponent();
        scrollView = new ScrollView();
        stack = new StackLayout();
        //Expander One
        expander = new SfExpander();
        //Expander Header
        var headergrid = new Grid()
        {
            HeightRequest =60
        };
        var headerLabel = new Label()
        {
            TextColor = Color.White,
            BackgroundColor = Color.Teal,
            HorizontalTextAlignment =TextAlignment.Center ,
            Text = "Veg Pizza",
            VerticalTextAlignment = TextAlignment.Center
        };
        headergrid.Children.Add(headerLabel);
        expander.Header = headergrid;
        //Expander Content
        var contentgrid = new Grid()
        {
            HeightRequest =60
        };
        var contentLabel = new Label()
        {
            TextColor = Color.Black,
            BackgroundColor = Color.White,
            Text = "Veg pizza is prepared with the items that meet vegetarian standards by not including any meat or animal tissue products.",
            VerticalTextAlignment = TextAlignment.Center,
            HeightRequest = 50
        };
        contentgrid.Children.Add(contentLabel);
        expander.Content = contentgrid;
        //Expander Two
        expander2 = new SfExpander();
        //Expander Header
        var headergrid2 = new Grid()
        {
            HeightRequest =60
        };
        var headerLabel2 = new Label()
        { TextColor = Color.White,
            BackgroundColor = Color.Teal,
            Text = "Non- Veg Pizza",
            HorizontalTextAlignment = TextAlignment.Center,
            VerticalTextAlignment = TextAlignment.Center
        };
        headergrid2.Children.Add(headerLabel2);
        expander2.Header = headergrid2;
        //Expander Content
        var contentgrid2 = new Grid();
        var contentLabel2 = new Label() 
        {
            TextColor = Color.Black,
            BackgroundColor = Color.White,
            Text = "Non-veg pizza is prepared by including the meat and animal tissue products.",
            VerticalTextAlignment = TextAlignment.Center,
            HeightRequest = 50
        };
        contentgrid2.Children.Add(contentLabel2);
        expander2.Content = contentgrid2;
        stack.Children.Add(expander);
        stack.Children.Add(expander2);
        scrollView.Content = stack;
        this.Content = scrollView;
    }
}

expander-c-xamarin's People

Contributors

jayaleshwari avatar sarubala20 avatar syncfusionbuild avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.