this text Name Text this member Member Name

  • Slides: 30
Download presentation

コードの対比(画面に値を表示) • 通常 • バイディング機能あり this. text. Name. Text = this. member. Member. Name;

コードの対比(画面に値を表示) • 通常 • バイディング機能あり this. text. Name. Text = this. member. Member. Name; this. text. Kana. Text = this. member. Member. Kana. Name; this. text. Zip. Code. Text = this. member. Member. Zip. Code; this. text. Address 1. Text = this. member. Member. Address 1; this. text. Address 2. Text = this. member. Member. Address 2; this. text. Tel. Text = this. member. Member. Tel. Code; this. text. Fax. Text = this. member. Member. Fax. Code; this. panel. Binding. Data = this. member; this. panel. Binding. View. Data(); わんくま同盟 大阪勉強会 #4

コードの対比(画面から入力値を取得) • 通常 • バイディング機能あり this. member. Member. Name = this. text. Name. Text;

コードの対比(画面から入力値を取得) • 通常 • バイディング機能あり this. member. Member. Name = this. text. Name. Text; this. member. Member. Kana. Name = this. text. Kana. Text; this. member. Member. Zip. Code = this. text. Zip. Code. Text; this. member. Member. Address 1 = this. text. Address 1. Text; this. member. Member. Address 2 = this. text. Address 2. Text; this. member. Member. Tel. Code = this. text. Tel. Text; this. member. Member. Fax. Code = this. text. Fax. Text; this. panel. Binding. Data = this. member; this. panel. Binding. Store. Data(); わんくま同盟 大阪勉強会 #4

コントロール側でのインターフェース • データバインディングコンテナ public interface IBinding. Container { bool Can. Binding{get; } IBinding. Data{set;

コントロール側でのインターフェース • データバインディングコンテナ public interface IBinding. Container { bool Can. Binding{get; } IBinding. Data{set; get; } void View. Data(); void Store. Data(); } • データバインディングコントロール public interface IBinding. Control { string Mapping. Name{set; get; } object Mapping. Data{set; get; } } わんくま同盟 大阪勉強会 #4

Text. Boxコントロール public string Mapping. Name { set{this. mapping. Name=value; } get{return this. mapping.

Text. Boxコントロール public string Mapping. Name { set{this. mapping. Name=value; } get{return this. mapping. Name; } } public object Mapping. Data { set { this. Text = ""; if(value==null){return; } this. Text = Convert. To. String(value); } get{return this. Text; } } わんくま同盟 大阪勉強会 #4

Binding. Containerクラス① public IBinding. Data { set { this. binding. Data = value; if(this.

Binding. Containerクラス① public IBinding. Data { set { this. binding. Data = value; if(this. binding. Data==null){return; } this. property. Infos = this. binding. Data. Get. Type(). Get. Properties(); } get{return this. binding. Data; } } public bool Can. Binding { get{return this. binding. Data!= null; } } わんくま同盟 大阪勉強会 #4

Binding. Containerクラス② public void View. Data(Control. Collection contros) { if(Can. Binding==false){return; } foreach(Control control

Binding. Containerクラス② public void View. Data(Control. Collection contros) { if(Can. Binding==false){return; } foreach(Control control in contros) { if(Is. Binding. Container(control)==true){ Binding. Container. View. Data ((IBinding. Container)control); continue; } if(Is. Binding. Control(control)==true){ Binding. Control. View. Data ((IBinding. Control)control); continue; } } } わんくま同盟 大阪勉強会 #4

Binding. Containerクラス③ private void Binding. Container. View. Data (IBinding. Container container) { if(container. Can.

Binding. Containerクラス③ private void Binding. Container. View. Data (IBinding. Container container) { if(container. Can. Binding==false) { container. Binding. Data = this. Binding. Data; } container. View. Data(); } private void Binding. Control. View. Data (IBinding. Control control) { control. Mapping. Data = Get. Mapping. Data(control); } わんくま同盟 大阪勉強会 #4

Binding. Containerクラス④ private object Get. Mapping. Data (IBinding. Control binding. Control) { Property. Info

Binding. Containerクラス④ private object Get. Mapping. Data (IBinding. Control binding. Control) { Property. Info property. Info = Get. Target. Property. Info(binding. Control. Mapping. Name); if(property. Info==null){return null; } return property. Info. Get. Value(this. binding. Data, null); } マッピング名に該当するプロパティから データを取得している。(即ち、画面表示) わんくま同盟 大阪勉強会 #4

Binding. Containerクラス⑤ private Property. Info Get. Target. Property. Info (string mapping. Name) { foreach(Property.

Binding. Containerクラス⑤ private Property. Info Get. Target. Property. Info (string mapping. Name) { foreach(Property. Info property. Info in this. property. Infos) { if(property. Info. Name==mapping. Name) { return property. Info; } } return null; } わんくま同盟 大阪勉強会 #4

Binding. Containerクラス⑥ public void Store. Data(Control. Collection contros) { if(Can. Binding==false){return; } foreach(Control control

Binding. Containerクラス⑥ public void Store. Data(Control. Collection contros) { if(Can. Binding==false){return; } foreach(Control control in contros) { if(Is. Binding. Container(control)==true){ Binding. Container. Store. Data ((IBinding. Container)control); continue; } if(Is. Binding. Control(control)==true){ Binding. Control. Store. Data ((IBinding. Control)control); continue; } } } わんくま同盟 大阪勉強会 #4

Binding. Containerクラス⑦ private void Binding. Container. Store. Data (IBinding. Container container) { if(container. Can.

Binding. Containerクラス⑦ private void Binding. Container. Store. Data (IBinding. Container container) { if(container. Can. Binding==false) { container. Binding. Data = this. Binding. Data; } container. Store. Data(); } private void Binding. Control Store. Data (IBinding. Control control) { Set. Mapping. Data(control); } わんくま同盟 大阪勉強会 #4

Binding. Containerクラス⑧ private void Set. Mapping. Data (IBinding. Control binding. Control) { Property. Info

Binding. Containerクラス⑧ private void Set. Mapping. Data (IBinding. Control binding. Control) { Property. Info property. Info = Get. Target. Property. Info(binding. Control. Mapping. Name); if(property. Info==null){return null; } property. Info. Set. Value(this. binding. Data, binding. Control. Mapping. Data, null); } マッピング名に該当するデータをプロパティ に設定している。(即ち、データ取得) わんくま同盟 大阪勉強会 #4