on dapfor wpf gridcontrol, data may change while the application is running. Just like the way price changes in financial market. How will I be able to sort the data.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
life guruPosted May 17, 2016, 2:53 PM
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;
}
Bhuvanesh MohankumarPosted May 17, 2016, 5:29 AM
As I said earlier, please try this link
http://www.dapfor.com/en/wpf-suite/gridcontrol/tutorial/tutorial-part9