12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- using System.Collections.Generic;
- using InABox.Core;
- using InABox.DynamicGrid;
- namespace InABox.Wpf;
- public abstract class MasterDetailGridPage<TMaster, TGrid, TDetail> : MasterDetailPage<TMaster>
- where TGrid : DynamicGrid<TDetail>, IDataModelSource, IMasterDetailControl<TMaster,TDetail>, new()
- where TDetail : BaseObject, new()
- {
- public TGrid? Grid { get; set; }
- public MasterDetailGridPage(DynamicTabItem tab) : base(tab)
- {
-
- }
- public override Dictionary<string, object[]>? Selected()
- {
- return Grid is not null
- ? new Dictionary<string, object[]>
- {
- { typeof(TDetail).EntityName(), Grid.SelectedRows }
- }
- : null;
- }
- protected abstract void DoRefresh(TGrid grid, bool columns);
- protected override IDataModelSource Refresh()
- {
- var bInitialised = false;
- if (Grid == null)
- {
- Grid = new TGrid();
- Tab.Content = Grid;
- }
- else
- {
- bInitialised = true;
- }
- Grid.Master = Master;
- DoRefresh(Grid,!bInitialised);
- return Grid;
- }
- }
|