|
@@ -30,7 +30,8 @@ namespace InABox.DynamicGrid
|
|
|
/// <param name="allowallitems">Show an "All Items" entry at tge top of the Groups List Box</param>
|
|
|
/// <param name="dataGrid">If null, finds a DynamicDataGrid of the specified entity type.
|
|
|
/// Otherwise, MasterList uses this parameter as the DynamicGrid type</param>
|
|
|
- public MasterList(Type type, string? groupby = null, string? selectedgroup = null, bool allowallitems = false, Type? dataGrid = null)
|
|
|
+ public MasterList(Type type, string? groupby = null, string? selectedgroup = null, bool allowallitems = false, Type? dataGrid = null,
|
|
|
+ IDynamicGrid? dynamicGrid = null)
|
|
|
{
|
|
|
InitializeComponent();
|
|
|
Type = type;
|
|
@@ -39,12 +40,19 @@ namespace InABox.DynamicGrid
|
|
|
CurrentGroup = selectedgroup;
|
|
|
GroupBy = groupby;
|
|
|
|
|
|
- if(dataGrid == null)
|
|
|
+ if(dynamicGrid is null)
|
|
|
{
|
|
|
- dataGrid = DynamicGridUtils.FindDynamicGrid(typeof(DynamicDataGrid<>), type);
|
|
|
+ if(dataGrid == null)
|
|
|
+ {
|
|
|
+ dataGrid = DynamicGridUtils.FindDynamicGrid(typeof(DynamicDataGrid<>), type);
|
|
|
+ }
|
|
|
+ grid = (Activator.CreateInstance(dataGrid) as IDynamicGrid) ?? throw new Exception($"Invalid Grid Type {dataGrid}");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ grid = dynamicGrid;
|
|
|
}
|
|
|
|
|
|
- grid = (IDynamicGrid)Activator.CreateInstance(dataGrid);
|
|
|
grid.Margin = new Thickness(5, 5, 5, 5);
|
|
|
((DependencyObject)grid).SetValue(Grid.ColumnProperty, 1);
|
|
|
((DependencyObject)grid).SetValue(Grid.RowProperty, 0);
|