using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace WpfApplication1
public partial class MainWindow : Window
public class BaseVM : INotifyPropertyChanged
public event PropertyChangedEventHandler PropertyChanged;
protected void Notify(string name)
h(this, new PropertyChangedEventArgs(name));
public class ViewModel : BaseVM
ObservableCollection<Row> _rows = new ObservableCollection<Row> ();
public ObservableCollection<Row> Rows { get { return _rows; } }
_rows.Add (new DividerRow () { Title = "Fruit" });
_rows.Add (new KeyValueRow () { Key = "Apple", Value = "$1.01" });
_rows.Add (new KeyValueRow () { Key = "Apricot", Value = "$2.01" });
_rows.Add (new KeyValueRow () { Key = "Pineapple", Value = "$3.01" });
_rows.Add (new DividerRow () { Title = "Meat" });
_rows.Add (new KeyValueRow () { Key = "Bacon", Value = "$4.01" });
_rows.Add (new KeyValueRow () { Key = "Ground-Turkey", Value = "$5.01" });
_rows.Add (new KeyValueRow () { Key = "Sausage", Value = "$6.01" });
_rows.Add (new KeyValueRow () { Key = "Andmorereallytastystuff", Value = "$7.01" });
public class Row : BaseVM { }
public class DividerRow : Row
if (_title == value) return;
public class KeyValueRow : Row
if (_key == value) return;
if (_value == value) return;