We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

convert ValueChanged event in LinearContentPointer to a command

i am using the CommunityToolkit in my maui app.

I would like to know how to convert the ValueChanged event in LinearContentPointer to a command.

I am able to convert the event LabelCreated in the SfLinearGauge by using EventToCommandBehavior. See code below:

                        <gauge:SfLinearGauge x:Name="heightCalculatorGauge"



                                 Interval="50" MinimumHeightRequest="120"






                            <gauge:SfLinearGauge.Behaviors>//here it works



                                    Command="{Binding HeightLabelCreatedCommand}"

                                    EventArgsConverter="{StaticResource LabelCreatedEventArgsConverter}"/>



                                <gauge:LinearShapePointer Value="120"








                                              Fill="#ff0074E3" >

                                    <gauge:LinearContentPointer.Behaviors>//ERROR: the attachable property "Behaviors" was not fount in type "LinearContentPointer"



                                    Command="{Binding ValueChangedCommand}"

                                    EventArgsConverter="{StaticResource ValueChangedEventArgsConverter}"/>



...MORE XAML....

but LinearContentPointer does not contains a list of Behavior. 

best regards.

3 Replies

VO Vishal Omprasad Syncfusion Team January 30, 2023 01:11 PM UTC

We regret to inform you that the behavior can only be included for VisualElement type, and unfortunately, the LinearContentPointer is not a VisualElement type. As a result, the command support for the ValueChanged event cannot be added to the LinearContentPointer.


We apologize for any disappointment this may cause and if there is anything else we can assist you with, please don't hesitate to reach out to us.

HS hassan salman January 31, 2023 01:21 AM UTC

Thank you for your response.

is there a way to convert this event to a command without behavior?

ET Eswaran Thirugnanasambandam Syncfusion Team January 31, 2023 02:02 PM UTC

We can invoke the command from the ValueChanged event as explained in the below link


We have prepared a sample to achieve your requirement and please get it from below attachment.

Attachment: LinearGaugeGettingStarted_d4ae9a7f.zip

Live Chat Icon For mobile
Up arrow icon