質問編集履歴
2
コードの修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -17,12 +17,12 @@
|
|
17
17
|
public DelegateCommand Loaded
|
18
18
|
{
|
19
19
|
get{
|
20
|
-
if (_Loaded == null) { return new DelegateCommand(
|
20
|
+
if (_Loaded == null) { return _Loaded= new DelegateCommand(load); }
|
21
21
|
else { return _Loaded; }
|
22
22
|
}
|
23
23
|
}
|
24
24
|
|
25
|
-
public void
|
25
|
+
public void load()
|
26
26
|
{
|
27
27
|
MessageBox.Show("Hello");
|
28
28
|
}
|
@@ -35,12 +35,12 @@
|
|
35
35
|
{
|
36
36
|
get{
|
37
37
|
MessageBox.Show("Hello");
|
38
|
-
if (_Loaded == null) { return new DelegateCommand(
|
38
|
+
if (_Loaded == null) { return _Loaded = new DelegateCommand(load); }
|
39
39
|
else { return _Loaded; }
|
40
40
|
}
|
41
41
|
}
|
42
42
|
|
43
|
-
public void
|
43
|
+
public void load()
|
44
44
|
{
|
45
45
|
|
46
46
|
}
|
1
より詳細の説明を加えた
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
Prism×WPFでデスクトップアプリケーションをつくっています。
|
2
2
|
LoadイベントをバイディングすることでHelloを表示しようとしているのですがうまくいきません。
|
3
3
|
|
4
|
-
xamlでは下のようにバインディング
|
4
|
+
xamlでは下のようにバインディングしています。
|
5
5
|
|
6
|
+
デバッグをしてみるとロード時にif内がtrueでreturn new DelegateCommand(loaded);まではいくのですがloaded関数は呼び出されていない(loadにブレークポイント置いても止まらない)といった感じです。
|
7
|
+
|
6
8
|
```
|
7
9
|
<i:Interaction.Triggers>
|
8
10
|
<i:EventTrigger EventName="Loaded">
|
@@ -12,11 +14,11 @@
|
|
12
14
|
```
|
13
15
|
|
14
16
|
```
|
15
|
-
|
17
|
+
public DelegateCommand Loaded
|
16
18
|
{
|
17
|
-
get
|
19
|
+
get{
|
18
|
-
{
|
19
|
-
return new DelegateCommand(loaded);
|
20
|
+
if (_Loaded == null) { return new DelegateCommand(loaded); }
|
21
|
+
else { return _Loaded; }
|
20
22
|
}
|
21
23
|
}
|
22
24
|
|
@@ -29,11 +31,12 @@
|
|
29
31
|
どうしてこんなことが起こってしまったのか...分かる方いましたらご教示ください。
|
30
32
|
宜しくお願い致します。
|
31
33
|
```
|
32
|
-
|
34
|
+
public DelegateCommand Loaded
|
33
35
|
{
|
34
|
-
get
|
36
|
+
get{
|
35
|
-
|
37
|
+
MessageBox.Show("Hello");
|
36
|
-
return new DelegateCommand(loaded);
|
38
|
+
if (_Loaded == null) { return new DelegateCommand(loaded); }
|
39
|
+
else { return _Loaded; }
|
37
40
|
}
|
38
41
|
}
|
39
42
|
|