Let's assume that your ZoomSlider
control is named myZoomSlider
like this:
<ZoomSlider x:Name="myZoomSlider" />
Now you can try two things to pass this control to your ToogleNew
method on your view-model, but first of all you need to define the method ToogleNew
so that it takes a ZoomControl
control or any of its super types as a parameter, something like this:
public void ToogleNew(ZoomSlider zoomSlider); // you can also pass any additional parameters if you like to
Now back to the two methods I told you about:
Try to pass the control as is like this:
cal:Message.Attach="[Event PreviewMouseLeftButtonDown] = [Action ToggleNew(myZoomSlider)]"
If the first option didn't work for you, then you can try the following:
<ZoomSlider x:Name="myZoomSlider" /> <Button Content="Toogle"> <i:Interaction.Triggers> <i:EventTrigger EventName="Click"> <cal:ActionMessage MethodName="ToogleNew"> <cal:Parameter Value="{Binding ElementName=myZoomSlider}" /> </cal:ActionMessage> </i:EventTrigger> </i:Interaction.Triggers> </Button>
You can take a look at the All about actions wiki documentation to learn everything and anything regarding actions and action messages.