質問編集履歴
1
ソースをマークダウン形式で編集しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -10,87 +10,87 @@
|
|
10
10
|
|
11
11
|
###該当のソースコード
|
12
12
|
Xamlソース
|
13
|
-
(略)
|
13
|
+
> (略)
|
14
|
-
↓ ViewModel上のイベントバインドしたメソッドが実行される
|
14
|
+
> ↓ ViewModel上のイベントバインドしたメソッドが実行される
|
15
|
-
<i:Interaction.Triggers>
|
15
|
+
> <i:Interaction.Triggers>
|
16
|
-
<i:EventTrigger EventName="Loaded">
|
16
|
+
> <i:EventTrigger EventName="Loaded">
|
17
|
-
<cmd:EventToCommand Command="{Binding PageMemberListLoadedCommand}" PassEventArgsToCommand="True" />
|
17
|
+
> <cmd:EventToCommand Command="{Binding PageMemberListLoadedCommand}" PassEventArgsToCommand="True" />
|
18
|
-
</i:EventTrigger>
|
18
|
+
> </i:EventTrigger>
|
19
|
-
</i:Interaction.Triggers>
|
19
|
+
> </i:Interaction.Triggers>
|
20
|
-
↑ ViewModel上のイベントバインドしたメソッドが実行される
|
20
|
+
> ↑ ViewModel上のイベントバインドしたメソッドが実行される
|
21
|
-
(略)
|
21
|
+
>(略)
|
22
|
-
<DataGridTemplateColumn x:Name="ColName" Width="150">
|
22
|
+
> <DataGridTemplateColumn x:Name="ColName" Width="150">
|
23
|
-
<DataGridTemplateColumn.Header>
|
23
|
+
> <DataGridTemplateColumn.Header>
|
24
|
-
<Button x:Name="ColNameTitleButton"
|
24
|
+
> <Button x:Name="ColNameTitleButton"
|
25
|
-
Content="名前"
|
25
|
+
> Content="名前"
|
26
|
-
Style="{StaticResource TitleButton}"
|
26
|
+
> Style="{StaticResource TitleButton}"
|
27
|
-
Width="150">
|
27
|
+
> Width="150">
|
28
|
+
> ↓ ViewModel上のイベントバインドしたメソッドが実行されない
|
29
|
+
> <i:Interaction.Triggers>
|
30
|
+
> <i:EventTrigger EventName="Click">
|
31
|
+
> <cmd:EventToCommand Command="{Binding ButtonClickCommand}" PassEventArgsToCommand="True" />
|
32
|
+
> </i:EventTrigger>
|
33
|
+
> </i:Interaction.Triggers>
|
34
|
+
> ↑ ViewModel上のイベントバインドしたメソッドが実行されない
|
35
|
+
> </Button>
|
36
|
+
> </DataGridTemplateColumn.Header>
|
37
|
+
> <DataGridTemplateColumn.CellTemplate>
|
38
|
+
> <DataTemplate>
|
39
|
+
> <Button x:Name="btnName"
|
40
|
+
> HorizontalContentAlignment="Left"
|
41
|
+
> Style="{StaticResource CellButton}"
|
42
|
+
> Width="150">
|
28
|
-
↓ ViewModel上のイベントバインドしたメソッドが実行されない
|
43
|
+
> ↓ ViewModel上のイベントバインドしたメソッドが実行されない
|
29
|
-
|
44
|
+
> <i:Interaction.Triggers>
|
30
|
-
|
45
|
+
> <i:EventTrigger EventName="Click">
|
31
|
-
|
46
|
+
> <cmd:EventToCommand Command="{Binding ButtonClickCommand}" PassEventArgsToCommand="True" />
|
32
|
-
|
47
|
+
> </i:EventTrigger>
|
33
|
-
|
48
|
+
> </i:Interaction.Triggers>
|
34
|
-
↑ ViewModel上のイベントバインドしたメソッドが実行されない
|
49
|
+
> ↑ ViewModel上のイベントバインドしたメソッドが実行されない
|
35
|
-
</Button>
|
36
|
-
</DataGridTemplateColumn.Header>
|
37
|
-
<DataGridTemplateColumn.CellTemplate>
|
38
|
-
<DataTemplate>
|
39
|
-
<Button x:Name="btnName"
|
40
|
-
HorizontalContentAlignment="Left"
|
41
|
-
Style="{StaticResource CellButton}"
|
42
|
-
Width="150">
|
43
|
-
↓ ViewModel上のイベントバインドしたメソッドが実行されない
|
44
|
-
<i:Interaction.Triggers>
|
45
|
-
|
50
|
+
> </Button>
|
46
|
-
<cmd:EventToCommand Command="{Binding ButtonClickCommand}" PassEventArgsToCommand="True" />
|
47
|
-
</i:EventTrigger>
|
48
|
-
</i:Interaction.Triggers>
|
49
|
-
↑ ViewModel上のイベントバインドしたメソッドが実行されない
|
50
|
-
</Button>
|
51
|
-
</DataTemplate>
|
51
|
+
> </DataTemplate>
|
52
|
-
</DataGridTemplateColumn.CellTemplate>
|
52
|
+
> </DataGridTemplateColumn.CellTemplate>
|
53
|
-
</DataGridTemplateColumn>
|
53
|
+
> </DataGridTemplateColumn>
|
54
54
|
|
55
55
|
ViewModelソース
|
56
|
-
↓ ViewModel上の実行されるメソッド
|
56
|
+
> ↓ ViewModel上の実行されるメソッド
|
57
|
-
private ICommand _PageMemberListLoadedCommand;
|
57
|
+
> private ICommand _PageMemberListLoadedCommand;
|
58
|
-
public ICommand PageMemberListLoadedCommand
|
58
|
+
> public ICommand PageMemberListLoadedCommand
|
59
|
-
{
|
59
|
+
> {
|
60
|
-
get
|
60
|
+
> get
|
61
|
-
{
|
61
|
+
> {
|
62
|
-
return _PageMemberListLoadedCommand ?? (_PageMemberListLoadedCommand = new RelayCommand<RoutedEventArgs>(PageMemberListLoaded));
|
62
|
+
> return _PageMemberListLoadedCommand ?? (_PageMemberListLoadedCommand = new RelayCommand<RoutedEventArgs>(PageMemberListLoaded));
|
63
|
+
> }
|
64
|
+
> }
|
63
|
-
|
65
|
+
>
|
66
|
+
> public void PageMemberListLoaded(RoutedEventArgs e)
|
67
|
+
> {
|
68
|
+
>(略)
|
69
|
+
> }
|
70
|
+
> ↑ ViewModel上の実行されるメソッド
|
64
|
-
|
71
|
+
>
|
72
|
+
> ↓ ViewModel上の実行されないメソッド
|
73
|
+
> private ICommand _ButtonClickCommand;
|
74
|
+
> public ICommand ButtonClickCommand
|
75
|
+
> {
|
76
|
+
> get
|
77
|
+
> {
|
78
|
+
> return _ButtonClickCommand ?? (_ButtonClickCommand = new RelayCommand<RoutedEventArgs>(ButtonClick));
|
79
|
+
> }
|
80
|
+
> }
|
81
|
+
>
|
82
|
+
> public void ButtonClick(RoutedEventArgs e)
|
83
|
+
> {
|
84
|
+
> try
|
85
|
+
> {
|
86
|
+
> MessageBox.Show("ButtonClick");
|
87
|
+
> }
|
88
|
+
> catch
|
89
|
+
> {
|
90
|
+
> }
|
91
|
+
> }
|
92
|
+
> ↑ ViewModel上の実行されないメソッド
|
65
93
|
|
66
|
-
public void PageMemberListLoaded(RoutedEventArgs e)
|
67
|
-
{
|
68
|
-
(略)
|
69
|
-
}
|
70
|
-
↑ ViewModel上の実行されるメソッド
|
71
|
-
|
72
|
-
↓ ViewModel上の実行されないメソッド
|
73
|
-
private ICommand _ButtonClickCommand;
|
74
|
-
public ICommand ButtonClickCommand
|
75
|
-
{
|
76
|
-
get
|
77
|
-
{
|
78
|
-
return _ButtonClickCommand ?? (_ButtonClickCommand = new RelayCommand<RoutedEventArgs>(ButtonClick));
|
79
|
-
}
|
80
|
-
}
|
81
|
-
|
82
|
-
public void ButtonClick(RoutedEventArgs e)
|
83
|
-
{
|
84
|
-
try
|
85
|
-
{
|
86
|
-
MessageBox.Show("ButtonClick");
|
87
|
-
}
|
88
|
-
catch
|
89
|
-
{
|
90
|
-
}
|
91
|
-
}
|
92
|
-
↑ ViewModel上の実行されないメソッド
|
93
|
-
|
94
94
|
```
|
95
95
|
|
96
96
|
###試したこと
|