Hi,
I try to get the DragComplete Event thru MVVM from the SFRangeSlider. I came up with like the code below, but maybe there is a more better way to do this:
IN XAML:
<range:SfRangeSlider
Margin="0,0,0,0"
DragCompleted="SfRangeSlider_DragCompleted"
FontAttribute="None"
FontSize="12"
HeightRequest="60"
KnobColor="LightSlateGray"
LabelPlacement="TopLeft"
Maximum="{Binding TotalDistance}"
Minimum="0"
Orientation="Horizontal"
ShowCustomLabel="False"
ShowRange="False"
ShowValueLabel="False"
StepFrequency="0.01"
ThumbSize="1"
TickColor="Black"
TickPlacement="None"
ToolTipPlacement="None"
ToolTipPrecision="2"
TrackColor="DarkGray"
TrackSelectionColor="DeepSkyBlue"
TrackSelectionThickness="1"
TrackThickness="3"
ValuePlacement="BottomRight"
Value="{Binding DistanceEnergy, Mode=TwoWay}">
<range:SfRangeSlider.CustomLabels>
<local:ObservableCollectionList>
<range:Items Label="{Binding AdditionalWeightSliderMin}" Value="{Binding AdditionalWeightSliderMin}" />
<range:Items Label="{Binding AdditionalWeightSliderMax}" Value="{Binding AdditionalWeightSliderMax}" />
</local:ObservableCollectionList>
</range:SfRangeSlider.CustomLabels>
<range:SfRangeSlider.Behaviors>
<behaviors:EventToCommandBehavior Command="{Binding DragCompletedCommand}" EventName="DragCompleted"/>
</range:SfRangeSlider.Behaviors>
</range:SfRangeSlider>
IN Viewmodel:
public Command DragCompletedCommand
{
get;
set;
}
public EvaluateViewModel()
{
DragCompletedCommand = new Command(DragComplete);
}
public void DragComplete()
{
// do something here
}
Hi Suganya,
thanks :) I have one more question, what is the advantage to do it the way you showed me over my solution. Both are working. The only advantage I can see, is t hat is will also have in the obj the Paramter true for thumb up delivered
Thanks a lot,
Markus