Articles in this section

How to add a content marker pointer in the .NET MAUI Linear Gauge (SfLinearGauge)?

In the Syncfusion® .NET MAUI Linear Gauge (SfLinearGauge), you can add a Content Marker Pointer to enhance your gauge display. This guide will demonstrate how to implement this feature using both XAML and C# code examples.

XAML:
The SfLinearGauge’s LinearContentPointer allows you to utilize any .NET MAUI content as a marker pointer. The label in the following code example is used as a marker pointer.

<gauge:SfLinearGauge VerticalOptions="Center" WidthRequest="600">
   <gauge:SfLinearGauge.MarkerPointers>
       <gauge:LinearContentPointer Value="30"  IsInteractive="True"
                                   ValueChanged="Pointer_ValueChanged"
                                   Position="Cross">
           <gauge:LinearContentPointer.Content>
               <Grid HeightRequest="32" WidthRequest="32">
                   <Ellipse Fill="#ff0074E3" HeightRequest="32" WidthRequest="32"/>
                   <Label Text="30" x:Name="textPointerLabel"
                          FontAttributes="Bold" HorizontalOptions="Center"
                          VerticalOptions="Center" TextColor="White"/>
               </Grid>
           </gauge:LinearContentPointer.Content>
       </gauge:LinearContentPointer>
   </gauge:SfLinearGauge.MarkerPointers>
</gauge:SfLinearGauge>

C#:

Set the label value using the ValueChanged Event handler.

private void Pointer_ValueChanged(object sender, Syncfusion.Maui.Gauges.ValueChangedEventArgs e)
{
   textPointerLabel.Text = ((int)e.Value).ToString();
}

Output:

ContentPointer.gif

Conclusion
I hope you enjoyed learning how to add a Content Marker Pointer in the .NET MAUI Linear Gauge (SfLinearGauge).

Refer to our .NET MAUI Linear Gauge’s feature tour page for 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!

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