ソース掲示板




すべてから検索

キーワード   条件 表示 現行ログ 過去ログ トピックス 名前 本文

  メンテナンス 前画面に戻る

対象スレッド 件名: ListItem2 クラス と 継承された ListItem クラス
名前: lightbox
処理選択
パスワード

件名 ListItem2 クラス と 継承された ListItem クラス
名前 lightbox
コメント
[[ListItem.cs]]
@DIV
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LBOX_ListBox
{
	public class ListItem : INotifyPropertyChanged
	{

		// 番号
		public string id { get; set; }
		// 名前
		public string name { get; set; }

		// **********************************************
		// ソースが変更されたことをバインド エンジンに通知する
		// ※ 初回のロードのみならば特に使用しない
		// **********************************************
		public event PropertyChangedEventHandler PropertyChanged;
		public void NotifyPropertyChanged(string propertyName)
		{
			if (PropertyChanged != null)
			{
				PropertyChanged(this,
					new PropertyChangedEventArgs(propertyName));
			}
		}

	}
}
@END

[[ListItem2.cs]]
@DIV
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LBOX_ListBox
{
	public class ListItem2 : ListItem
	{
		// 名前
		private string _name;
		new public string name
		{
			get
			{
				return _name;
			}
			set
			{
				_name = value;
				this.NotifyPropertyChanged("name");
			}
		}
	}
}
@END