BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
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"
Minimum="0"
Maximum="250"
Interval="50" MinimumHeightRequest="120"
HorizontalOptions="Center"
MinorTicksPerInterval="0"
Orientation="Vertical"
TickPosition="Outside"
LabelPosition="Outside">
<gauge:SfLinearGauge.Behaviors>//here it works
<toolkit:EventToCommandBehavior
EventName="LabelCreated"
Command="{Binding HeightLabelCreatedCommand}"
EventArgsConverter="{StaticResource LabelCreatedEventArgsConverter}"/>
</gauge:SfLinearGauge.Behaviors>
<gauge:SfLinearGauge.MarkerPointers>
<gauge:LinearShapePointer Value="120"
x:Name="heightCalculatorShape"
ShapeType="Rectangle"
Position="Outside"
EnableAnimation="True"
IsInteractive="True"
ShapeHeight="1.5"
ShapeWidth="165"
Fill="#ff0074E3" >
<gauge:LinearContentPointer.Behaviors>//ERROR: the attachable property "Behaviors" was not fount in type "LinearContentPointer"
<toolkit:EventToCommandBehavior
EventName="ValueChanged"
Command="{Binding ValueChangedCommand}"
EventArgsConverter="{StaticResource ValueChangedEventArgsConverter}"/>
</gauge:LinearContentPointer.Behaviors>
</gauge:LinearShapePointer>
...MORE XAML....
but LinearContentPointer does not contains a list of Behavior.
best regards.
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.
Thank you for your response.
is there a way to convert this event to a command without behavior?
We can invoke the command from the ValueChanged event as explained in the below link
https://dotnetdevaddict.co.za/2017/07/13/turning-events-into-commands/
We
have prepared a sample to achieve your requirement and please get it from below
attachment.