0
This code will help you as you use dapfor wpf gridcontrol.
C#
class Product : INotifyPropertyChanged
{
private readonly string _name;
private double _price;
public Product(string name)
{
_name = name;
}
public string Name { get { return _name; } }
public double Price
{
get { return _price; }
set
{
if(_price != value)
{
_price = value;
if(PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs("Price"));
}
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
}
public void Populate(GridControl grid)
{
//Create some products
Product product1 = new Product("Product 1");
Product product2 = new Product("Product 2");
product1.Price = 7;
product2.Price = 9;
//Add them to the grid
grid.Rows.Add(product1);
grid.Rows.Add(product2);
//Sort the content
grid.Headers[0]["Price"].SortDirection = SortDirection.Ascending;
//The grid will move the product1 to the appropriate position
product1.Price = 10;
}
0