How to add content in the range in NET MAUI Linear Gauge (SfLinearGauge)?
The Syncfusion® .NET MAUI Linear Gauge (SfLinearGauge) allows you to add content within a range. This guide demonstrates how to add content inside the range using the gauge.
XAML:
Utilize the Child property of LinearRange to add any content as a child to a range. Refer to the following code example for better understanding.
<Grid VerticalOptions="Center" WidthRequest="600">
<gauge:SfLinearGauge x:Name="gauge">
<gauge:SfLinearGauge.Ranges>
<gauge:LinearRange StartWidth="20" EndWidth="40"
StartValue="0"
EndValue="30" Fill="Green">
<gauge:LinearRange.Child>
<Label Text="Slow" HorizontalOptions="Center"
VerticalOptions="Center" TextColor="Black"/>
</gauge:LinearRange.Child>
</gauge:LinearRange>
<gauge:LinearRange StartWidth="40" EndWidth="60"
StartValue="30"
EndValue="70" Fill="Orange">
<gauge:LinearRange.Child>
<Label Text="Average" HorizontalOptions="Center"
VerticalOptions="Center" TextColor="Black"/>
</gauge:LinearRange.Child>
</gauge:LinearRange>
<gauge:LinearRange StartWidth="60" EndWidth="80"
StartValue="70"
EndValue="100" Fill="Red">
<gauge:LinearRange.Child>
<Label Text="High Speed" HorizontalOptions="Center"
VerticalOptions="Center" TextColor="Black"/>
</gauge:LinearRange.Child>
</gauge:LinearRange>
</gauge:SfLinearGauge.Ranges>
</gauge:SfLinearGauge>
</Grid>
Output:
Conclusion:
I hope you enjoyed learning how to add content in the range using the .NET MAUI Linear Gauge (SfLinearGauge).
Refer to our .NET MAUI Linear Gauge feature tour page to learn about its other groundbreaking feature representations. You can also explore our .NET MAUI Linear Gauge documentation to understand how to present and manipulate data.
For current customers, check out our .NET MAUI components from the License and Downloads page. If you are new to Syncfusion®, try our 30-day free trial to check out our .NET MAUI Linear Gauge and other .NET MAUI components.
Please let us know in the comment section if you have any queries or require clarification. Contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!