Hello ,
In .net maui for windows. When using both Bar Pointer and Content Marker Pointer of LinearGauge. The content marker doesn't show text . Also instead of fixed Value="50". I am binding the values and Label text to ViewModel
<gauge:SfLinearGauge.MarkerPointers> <gauge:LinearContentPointer Value="50" Alignment="End"> <gauge:LinearContentPointer.Content> <Grid HeightRequest="25" WidthRequest="25"> <RoundRectangle CornerRadius="5" Fill="#ff0074E3"/> <Label Text="50" HorizontalOptions="Center" VerticalOptions="Center" TextColor="White"/> </Grid> </gauge:LinearContentPointer.Content> </gauge:LinearContentPointer> </gauge:SfLinearGauge.MarkerPointers>
thanks for helping to see why the text is showing
Hi Praveen,
Regarding “content marker does not show text when binding”:
Based on the details provided, we have reviewed your query and identified that this scenario can be resolved at the sample level.
We recommend explicitly setting the binding source using the {x:Reference} markup extension and applying a converter to convert the ContentPointer.Value (of type double) to a string, as demonstrated in the following code snippet:
[XAML]:
|
<gauge:SfLinearGauge> <gauge:SfLinearGauge.MarkerPointers> <gauge:LinearContentPointer x:Name="pointer" Value="{Binding PointerValue}" Alignment="End" IsInteractive="True"> <gauge:LinearContentPointer.Content> <Grid HeightRequest="25" WidthRequest="25"> <RoundRectangle CornerRadius="5" Fill="#ff0074E3" /> <Label Text="{Binding Source={x:Reference pointer}, Path=Value, Converter={x:StaticResource DecimalValueConverterKey}}" HorizontalOptions="Center" VerticalOptions="Center" TextColor="White" /> </Grid> </gauge:LinearContentPointer.Content> </gauge:LinearContentPointer> </gauge:SfLinearGauge.MarkerPointers> <gauge:SfLinearGauge.BarPointers> <gauge:BarPointer Value="{Binding Source={x:Reference pointer}, Path=Value}" /> </gauge:SfLinearGauge.BarPointers> </gauge:SfLinearGauge> |
We have prepared an example sample illustrating this above approach and attached it below for your reference. Please check the attached sample and let us know whether your requirement is achieved.
Note: We have used the built-in converters from Syncfusion, but you can also create a custom Value-To-String converter to convert ContentPointer.Value for Label.Text.
We hope that this helps you. Please let us know if you need further assistance.
Regards,
Vishal O.