回答編集履歴
1
追記
answer
CHANGED
@@ -8,4 +8,21 @@
|
|
8
8
|
めったに使わないと存在をわすれますしね。
|
9
9
|
|
10
10
|
コードビハインドに書く(書ける)のはViewで完結するものだけですので、カスタムコントロールなどに封じて
|
11
|
-
それをコントロールライブラリに納めれば保守性もテスタビリティも上がります。
|
11
|
+
それをコントロールライブラリに納めれば保守性もテスタビリティも上がります。
|
12
|
+
|
13
|
+
--- コード追記 ---
|
14
|
+
C# 7.X だとこうですね。
|
15
|
+
``` C#
|
16
|
+
private void Left2rightCommandExecute(object parameter)
|
17
|
+
{
|
18
|
+
if(parameter is ItemViewModel item)
|
19
|
+
{
|
20
|
+
item.Selected = false;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
private DelegateCommand<object> _left2rightCommand;
|
25
|
+
public DelegateCommand<object> Left2RightCommand =>
|
26
|
+
_left2rightCommand = _left2rightCommand ??
|
27
|
+
new DelegateCommand<object>(Left2rightCommandExecute);
|
28
|
+
```
|