Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 20th, 2012  |  syntax: None  |  size: 0.75 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Dynamic Data binding in WPF Devx GridControl
  2. public class Property : INotifyPropertyChanged
  3. {
  4.     public Property(string name, object value)
  5.     {
  6.         Name = name;
  7.         Value = value;
  8.     }
  9.  
  10.     public string Name { get; private set; }
  11.     public object Value { get; set; }
  12. }
  13.  
  14.  
  15. public class Record
  16. {
  17.     private readonly ObservableCollection<Property> properties = new ObservableCollection<Property>();
  18.  
  19.     public Record(params Property[] properties)
  20.     {
  21.         foreach (var property in properties)
  22.             Properties.Add(property);
  23.     }
  24.  
  25.     public ObservableCollection<Property> Properties
  26.     {
  27.         get { return properties; }
  28.     }
  29. }
  30.        
  31. <DataGrid
  32.    Name="dataGrid"
  33.    AutoGenerateColumns="false"
  34.    ItemsSource="{Binding Path=Records}"/>