I have a slider control in view i need to call the ValueChanged
event of slider and update one property in model based on that. how i can implement this using MVVM pattern.
where I have to write the ValueChanged
event? how i can connect ValueChanged
event code with view?
Asked
Active
Viewed 1,513 times
0
1 Answers
1
i just take the answer from here cause i use it in my projects too:
You should use an EventTrigger in combination with InvokeCommandAction from the Windows.Interactivity namespace. Here is an example:
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding SelectedItemChangedCommand}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
-
thank you for your answer. but Interaction.Triggers is not found in my application. is it required to add any other dll files? – niknowj Jan 31 '12 at 12:41
-
its the Windows.Interactivity namespace and comes from the Blend SDK - System.Windows.Interactivity.dll – blindmeis Jan 31 '12 at 14:33
-
here is the download link: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=10801 – blindmeis Jan 31 '12 at 14:34
-
The link you provided is for framework 4. am using framework 3.5 so i installed blend 3 sdk. but still i have not found exception. – niknowj Feb 01 '12 at 12:57
-
sorry i really dont know if its in the .net3.5 sdk from blend :( – blindmeis Feb 02 '12 at 14:17