ソース掲示板




すべてから検索

キーワード   条件 表示 現行ログ 過去ログ トピックス 名前 本文
Windows8(C#) ストアアプリ MVVM : ListBox テンプレート 用 画面( XAML ) バインド用クラス : ( No.0 )
日時: 2013/05/22 22:42
名前: lightbox



ListMain.cs
拡張子:
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LBOX_ListBox
{
	public class ListMain : INotifyPropertyChanged
	{

		// *****************************************************
		// コンストラクタ
		// *****************************************************
		public ListMain()
		{
			// バインド用のコレクションのインスタンスを設定
			this.Items = new ObservableCollection<ListItem2>();
		}

		// *****************************************************
		// バインド用のコレクションのプロパティ
		// ※ ListItem クラスを使用しています
		// *****************************************************
		public ObservableCollection<ListItem2> Items { get; private set; }

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