Created
February 28, 2013 01:16
-
-
Save ishikura/5053379 to your computer and use it in GitHub Desktop.
LivetでView側からViewModel側の引数付きメソッドを実施する時(引数はとりあえずstringのみ確認した)のちょっとメモ。以下の2通りのやり方で引き渡せた。使い分けとか他にもっといい方法が…とかは今後。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--その1 MethodParameterに文字列を設定 --> | |
・View(XAML)側 | |
<Button Content="AC" Name="buttonAC"> | |
<i:Interaction.Triggers> | |
<i:EventTrigger EventName="Click"> | |
<l:LivetCallMethodAction MethodName="ClearButton" MethodTarget="{Binding}" MethodParameter="AC"/> | |
</i:EventTrigger> | |
</i:Interaction.Triggers> | |
</Button> | |
→ VM側で、public void ClearButton(string value) でvalueに文字列"AC"を受け取れた--> | |
<!--その2 CommandParameterに文字列を設定 --> | |
・View(XAML)側 | |
<Button Command="{Binding NumberButtonCommand}" CommandParameter="CE" Content="CE"> | |
→ VM側で、ListenerCommandの引数で文字列"CE"を受け取れた |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment