Thursday, June 18, 2009

ObservableCollection : Example

This is the example how to use the observable collection in Silverlight and WPF.

Example:

public class obsMonth {
public int _Month { get; set; }
public int _Year { get; set; }
public int _Day { get; set; }
public obsMonth(int iDays, int iMonth, int iYear)
{
this._Day = iDays;
this._Month = iMonth;
this._Year = iYear;
}

public obsMonth()
{//Constructor
}
}
public class ColMonths : ObservableCollection
{
public ColMonths()
{
}
}

In code behind C#:

ColMonths Months = new ColMonths();
obsMonth oMonths ;

oMonths = new oMonths(15,1,2009);
Months.Add(oMonths);

oMonths = new oMonths(16,1,2009);
Months.Add(oMonths);

oMonths = new oMonths(17,1,2009);
Months.Add(oMonths);


its quiet easy to use it.


No comments:

Post a Comment

Earn Money - Quickly

Heaven - it is ok but try to earn money at hellishdollars.com !