#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2016
    Posts
    2
    Rep Power
    0

    data modification


    When data is modified, how can a programmer inform the grid about it using Row.Update() method.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2016
    Posts
    2
    Rep Power
    0

    setup data filtering


    I am using dapfor wpf gridcontrol and I need an example on how a programmer can setup data filtering or visibility base on his set rules.
  4. #3
  5. Lazy Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,436
    Rep Power
    9645
    I merged your two threads because I suspect they're related, and moved them in here because you're asking about something to do with WPF.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2016
    Posts
    1
    Rep Power
    0
    Originally Posted by andlaty
    I am using dapfor wpf gridcontrol and I need an example on how a programmer can setup data filtering or visibility base on his set rules.
    This method is called in the following cases:
    when a filter is replaced, i.e. when GridControl.Filter property is called.
    when new data is added to the grid for rows that are associated with newly added data.
    when data is updated (i.e. when Row.Update() methods are called and when the grid gets notifications from INotifyPropertyChanged or IBindingList interface).
    C#
    Code:
    //Quote class implementing INotifyPropertyChanged interface 
    class Quote : INotifyPropertyChanged 
    { 
        private readonly int _quantity; 
        private double _price; 
    
        public Quote(int quantity, double price) 
        { 
            _quantity = quantity; 
            _price = price; 
        } 
    
        public int Quantity { get { return _quantity; } } 
        public double Price 
        { 
            get { return _price; } 
            set 
            { 
                if (_price != value) 
                { 
                    _price = value; 
                    if(PropertyChanged != null) 
                    { 
                        PropertyChanged(this, new PropertyChangedEventArgs("Price")); 
                    } 
                } 
            } 
        } 
        public event PropertyChangedEventHandler PropertyChanged; 
    } 
    
    //Set some filter: 
    grid.Filter = new Filter(delegate(Row row) 
    { 
        double price = (double) row["Price"].Value; 
        return price < 1000; 
    }); 
    
    //Populate grid with some values: 
    List<Quote> collection = new List<Quote>(); 
    for (int i = 0; i < 5; ++i) 
    { 
        collection.Add(new Quote(i, 1000 + 100 * i)); 
    } 	
    grid.ItemsSource = collection; 
    
    //All 5 rows are displayed right now. Change price of a quote: 
    collection[4].Price = 900; 
    
    //The row becomes invisible. .Wpf GridControl displays only 4 row

IMN logo majestic logo threadwatch logo seochat tools logo