質問編集履歴

3

インデント

2016/08/06 04:00

投稿

Shiokawa
Shiokawa

スコア10

title CHANGED
File without changes
body CHANGED
@@ -13,39 +13,38 @@
13
13
  現在のソースはすべて変数名でBindingさせて表示させている。
14
14
  以下
15
15
  ```ここに言語を入力
16
- private string listName0;
16
+ private string listName0;
17
- private string listName1;
17
+ private string listName1;
18
18
 
19
- public string ListName0
19
+ public string ListName0
20
- {
20
+ {
21
- get { return listName0; }
21
+ get { return listName0; }
22
- set { SetProperty(ref listName0, value, "ListName0"); }
22
+ set { SetProperty(ref listName0, value, "ListName0"); }
23
- }
23
+ }
24
- public string ListName1
24
+ public string ListName1
25
- {
25
+ {
26
- get { return listName1; }
26
+ get { return listName1; }
27
- set { SetProperty(ref listName1, value, "ListName1"); }
27
+ set { SetProperty(ref listName1, value, "ListName1"); }
28
- }
28
+ }
29
29
 
30
30
 
31
- public virtual bool SetProperty<T>(ref T target, T value, string name)
31
+ public virtual bool SetProperty<T>(ref T target, T value, string name)
32
- {
32
+ {
33
- if (target == null)
33
+ if (target == null)
34
- {
34
+ {
35
- if (value == null)
35
+ if (value == null)
36
- return false;
36
+ return false;
37
- }
37
+ }
38
- else
38
+ else
39
- {
39
+ {
40
- if (target.Equals(value))
40
+ if (target.Equals(value))
41
- return false;
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
- Binding textNamebinding = new Binding();
63
+ Binding textNamebinding = new Binding();
65
- string name = "ListName" + (ikoumokuNo).ToString();
64
+ string name = "ListName" + (ikoumokuNo).ToString();
66
- textNamebinding.Path = new PropertyPath(name);
65
+ textNamebinding.Path = new PropertyPath(name);
67
- BindingOperations.SetBinding(labelns[iLabelNo], Label.ContentProperty, textNamebinding);
66
+ BindingOperations.SetBinding(labelns[iLabelNo], Label.ContentProperty, textNamebinding);
68
67
  ```
69
68
  ikoumokuNoの変数でBindingする変数を特定させている。
70
69
 

2

インデント

2016/08/06 03:59

投稿

Shiokawa
Shiokawa

スコア10

title CHANGED
File without changes
body CHANGED
@@ -13,8 +13,8 @@
13
13
  現在のソースはすべて変数名でBindingさせて表示させている。
14
14
  以下
15
15
  ```ここに言語を入力
16
- private string listName0;
16
+ private string listName0;
17
- private string listName1;
17
+ private string listName1;
18
18
 
19
19
  public string ListName0
20
20
  {

1

タグ </> ボタン

2016/08/06 03:48

投稿

Shiokawa
Shiokawa

スコア10

title CHANGED
File without changes
body CHANGED
@@ -12,7 +12,8 @@
12
12
  ###該当のソースコード
13
13
  現在のソースはすべて変数名でBindingさせて表示させている。
14
14
  以下
15
+ ```ここに言語を入力
15
- private string listName0;
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