public DataGrid(IDataGridSource dataSource) { InitializeComponent(); SetSource(dataSource); EntryList.SelectionChanged += (s, e) => EntryList.ScrollIntoView(EntryList.SelectedItem); dataSource.GetIDPropertyInfo(); }
public DataGridVM(IDataGridSource dataSource) { DataSource = dataSource ?? throw new ArgumentNullException(nameof(dataSource)); _commands.AddCommand("AddEntryFromList", x => AddEntryFromList()); _commands.AddCommand("AddNew", x => AddNewEntry()); _commands.AddCommand("RemoveEntry", x => RemoveEntry()); _commands.AddCommand("Save", x => Save()); UpdateList(); }
public void SetSource(IDataGridSource source) { _vm = new DataGridVM(source); DataContext = _vm; GenerateFields(_vm.DataSource.GetTypeOfObjects(), _vm.GetFields()); //verify that the ID is avaiable var id = source.GetIDPropertyInfo(); if (id == null) { throw new Exception("ID not identified!"); } }
public static void RegisterDataSource(IDataGridSource dataSource) { KnownSources.Add(dataSource.GetTypeOfObjects(), dataSource); }
public ForeignKeyConverter(IDataGridSource dataSource) { _dataSource = dataSource ?? throw new ArgumentNullException(); _pkPropertyInfo = dataSource.GetIDPropertyInfo(); }