Articles in this section
Category / Section

How to show WebView in .NET MAUI Accordion (SfAccordion)?

3 mins read

The .NET MAUI Accordion allows you to display a WebView within an Accordion by setting the WebView height in .NET MAUI.

Below is a code snippet to incorporate WebView in SfAccordion:

<syncfusion:SfAccordion ExpandMode="SingleOrNone">
    <syncfusion:SfAccordion.Items>
        <syncfusion:AccordionItem>
            <syncfusion:AccordionItem.Header>
                <Grid>
                    <Label TextColor="#495F6E" Text=".NET MAUI" Margin="5" HeightRequest="50" VerticalTextAlignment="Center"/>
                </Grid>
            </syncfusion:AccordionItem.Header>
            <syncfusion:AccordionItem.Content>
                <StackLayout Padding="10,10,10,10" BackgroundColor="#FFFFFF">
                    <WebView HeightRequest="250" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Source="https://dotnet.microsoft.com/en-us/apps/maui" />
                </StackLayout>
            </syncfusion:AccordionItem.Content>
        </syncfusion:AccordionItem>
        <syncfusion:AccordionItem>
            <syncfusion:AccordionItem.Header>
                <Grid>
                    <Label TextColor="#495F6E" Text="Syncfusion" Margin="5" HeightRequest="50" VerticalTextAlignment="Center"/>
                </Grid>
            </syncfusion:AccordionItem.Header>
            <syncfusion:AccordionItem.Content>
                <StackLayout Padding="10,10,10,10" BackgroundColor="#FFFFFF">
                    <WebView HeightRequest="400" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Source="https://www.syncfusion.com/" />
                </StackLayout>
            </syncfusion:AccordionItem.Content>
        </syncfusion:AccordionItem>
        <syncfusion:AccordionItem>
            <syncfusion:AccordionItem.Header>
                <Grid>
                    <Label TextColor="#495F6E" Text="Accordion" Margin="5" HeightRequest="50" VerticalTextAlignment="Center"/>
                </Grid>
            </syncfusion:AccordionItem.Header>
            <syncfusion:AccordionItem.Content>
                <StackLayout Padding="10,10,10,10" BackgroundColor="#FFFFFF">
                    <WebView HeightRequest="400" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Source="https://help.syncfusion.com/maui/accordion/getting-started" />
                </StackLayout>
            </syncfusion:AccordionItem.Content>
        </syncfusion:AccordionItem>
    </syncfusion:SfAccordion.Items>
</syncfusion:SfAccordion>

Download the complete sample on GitHub

Output

AccordionWebView.png

Conclusion
I hope you enjoyed learning how to use WebView in SfAccordion in .NET MAUI.
You can refer to our .NET MAUI Accordion feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started with configuration specifications. Explore our .NET MAUI Accordion example to understand how to create and manipulate data.
For current customers, check out our components from the License and Downloads page. If you are new to Syncfusion®, try our 30-day free trial to check out our other controls.
Please let us know in the comments section if you have any queries or require clarification. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied