This sample demonstrates how to create dynamic tabs using a remote data source with the .NET MAUI Tab View control in a .NET MAUI application.
<tabview:SfTabView x:Name="LocationTabView" ItemsSource="{Binding Cities}" IndicatorBackground="White">
<!-- Header: city title -->
<tabview:SfTabView.HeaderItemTemplate>
<DataTemplate>
<Label Text="{Binding Name}" TextColor="White" VerticalTextAlignment="Center"/>
</DataTemplate>
</tabview:SfTabView.HeaderItemTemplate>
<!-- Content: weather UI -->
<tabview:SfTabView.ContentItemTemplate>
<DataTemplate>
<ScrollView>
<VerticalStackLayout>
<!-- current date -->
<Label Text="{Binding DateText}" TextColor="White" HorizontalOptions="Center" />
<!-- current weather icon -->
<Image Source="{Binding Icon}" HorizontalOptions="Center"/>
<!-- current weather condition -->
<Label Text="{Binding ConditionText}" HorizontalOptions="Center" TextColor="White"/>
<!-- current temperature -->
<Label Text="{Binding TempText}" TextColor="White" HorizontalOptions="Center" />
<!-- Daily Forecast -->
<ScrollView Orientation="Horizontal">
<CollectionView ItemsSource="{Binding NextDays}" ItemsLayout="HorizontalList"
HorizontalOptions="Center" SelectionMode="None">
<!-- Scrollable view for daily weather forecast -->
</CollectionView>
</ScrollView>
</VerticalStackLayout>
</ScrollView>
</DataTemplate>
</tabview:SfTabView.ContentItemTemplate>
</tabview:SfTabView>To run the demo, refer to System Requirements for .NET MAUI
If you are facing path too long exception when building this example project, close Visual Studio and rename the repository to short and build the project.
Syncfusion has no liability for any damage or consequence that may arise from using or viewing the samples. The samples are for demonstrative purposes. If you choose to use or access the samples, you agree to not hold Syncfusion liable, in any form, for any damage related to use, for accessing, or viewing the samples. By accessing, viewing, or seeing the samples, you acknowledge and agree Syncfusion's samples will not allow you seek injunctive relief in any form for any claim related to the sample. If you do not agree to this, do not view, access, utilize, or otherwise do anything with Syncfusion's samples.
