質問編集履歴
3
インデント
title
CHANGED
File without changes
|
body
CHANGED
@@ -13,39 +13,38 @@
|
|
13
13
|
現在のソースはすべて変数名でBindingさせて表示させている。
|
14
14
|
以下
|
15
15
|
```ここに言語を入力
|
16
|
-
|
16
|
+
private string listName0;
|
17
|
-
|
17
|
+
private string listName1;
|
18
18
|
|
19
|
-
|
19
|
+
public string ListName0
|
20
|
-
|
20
|
+
{
|
21
|
-
|
21
|
+
get { return listName0; }
|
22
|
-
|
22
|
+
set { SetProperty(ref listName0, value, "ListName0"); }
|
23
|
-
|
23
|
+
}
|
24
|
-
|
24
|
+
public string ListName1
|
25
|
-
|
25
|
+
{
|
26
|
-
|
26
|
+
get { return listName1; }
|
27
|
-
|
27
|
+
set { SetProperty(ref listName1, value, "ListName1"); }
|
28
|
-
|
28
|
+
}
|
29
29
|
|
30
30
|
|
31
|
-
|
31
|
+
public virtual bool SetProperty<T>(ref T target, T value, string name)
|
32
|
-
|
32
|
+
{
|
33
|
-
|
33
|
+
if (target == null)
|
34
|
-
|
34
|
+
{
|
35
|
-
|
35
|
+
if (value == null)
|
36
|
-
|
36
|
+
return false;
|
37
|
-
|
37
|
+
}
|
38
|
-
|
38
|
+
else
|
39
|
-
|
39
|
+
{
|
40
|
-
|
40
|
+
if (target.Equals(value))
|
41
|
-
|
41
|
+
return false;
|
42
|
-
|
42
|
+
}
|
43
|
+
target = value;
|
44
|
+
RaisePropertyChanged(name);
|
45
|
+
return true;
|
46
|
+
}
|
43
47
|
|
44
|
-
target = value;
|
45
|
-
RaisePropertyChanged(name);
|
46
|
-
return true;
|
47
|
-
}
|
48
|
-
|
49
48
|
```
|
50
49
|
最終的にINotifyPropertyChanged を継承したクラスでView側にBindingさせる。
|
51
50
|
```ここに言語を入力
|
@@ -61,10 +60,10 @@
|
|
61
60
|
View側ソース
|
62
61
|
loadイベントで実行するのコード
|
63
62
|
```ここに言語を入力
|
64
|
-
|
63
|
+
Binding textNamebinding = new Binding();
|
65
|
-
|
64
|
+
string name = "ListName" + (ikoumokuNo).ToString();
|
66
|
-
|
65
|
+
textNamebinding.Path = new PropertyPath(name);
|
67
|
-
|
66
|
+
BindingOperations.SetBinding(labelns[iLabelNo], Label.ContentProperty, textNamebinding);
|
68
67
|
```
|
69
68
|
ikoumokuNoの変数でBindingする変数を特定させている。
|
70
69
|
|
2
インデント
title
CHANGED
File without changes
|
body
CHANGED
@@ -13,8 +13,8 @@
|
|
13
13
|
現在のソースはすべて変数名でBindingさせて表示させている。
|
14
14
|
以下
|
15
15
|
```ここに言語を入力
|
16
|
-
|
16
|
+
private string listName0;
|
17
|
-
|
17
|
+
private string listName1;
|
18
18
|
|
19
19
|
public string ListName0
|
20
20
|
{
|
1
タグ </> ボタン
title
CHANGED
File without changes
|
body
CHANGED
@@ -12,7 +12,8 @@
|
|
12
12
|
###該当のソースコード
|
13
13
|
現在のソースはすべて変数名でBindingさせて表示させている。
|
14
14
|
以下
|
15
|
+
```ここに言語を入力
|
15
|
-
|
16
|
+
private string listName0;
|
16
17
|
private string listName1;
|
17
18
|
|
18
19
|
public string ListName0
|
@@ -45,7 +46,9 @@
|
|
45
46
|
return true;
|
46
47
|
}
|
47
48
|
|
49
|
+
```
|
48
50
|
最終的にINotifyPropertyChanged を継承したクラスでView側にBindingさせる。
|
51
|
+
```ここに言語を入力
|
49
52
|
protected virtual void RaisePropertyChanged(string name)
|
50
53
|
{
|
51
54
|
var h = PropertyChangedHandler;
|
@@ -53,13 +56,16 @@
|
|
53
56
|
h(this, new PropertyChangedEventArgs(name));
|
54
57
|
}
|
55
58
|
|
59
|
+
```
|
56
60
|
|
57
61
|
View側ソース
|
58
62
|
loadイベントで実行するのコード
|
63
|
+
```ここに言語を入力
|
59
64
|
Binding textNamebinding = new Binding();
|
60
65
|
string name = "ListName" + (ikoumokuNo).ToString();
|
61
66
|
textNamebinding.Path = new PropertyPath(name);
|
62
67
|
BindingOperations.SetBinding(labelns[iLabelNo], Label.ContentProperty, textNamebinding);
|
68
|
+
```
|
63
69
|
ikoumokuNoの変数でBindingする変数を特定させている。
|
64
70
|
|
65
71
|
|