|
@@ -83,10 +83,16 @@ namespace InABox.DynamicGrid
|
|
|
|
|
|
public event IDynamicGrid.ReconfigureEvent? OnReconfigure;
|
|
|
|
|
|
+ private bool _hasLoadedOptions = false;
|
|
|
+
|
|
|
public BaseDynamicGrid()
|
|
|
{
|
|
|
Options = new FluentList<DynamicGridOption>();
|
|
|
- Options.OnChanged += OptionsChanged;
|
|
|
+ Options.OnChanged += (sender, args) =>
|
|
|
+ {
|
|
|
+ _hasLoadedOptions = true;
|
|
|
+ OptionsChanged();
|
|
|
+ };
|
|
|
|
|
|
RowStyleSelector = GetRowStyleSelector();
|
|
|
RowStyleSelector.GetStyle += (row, style) => GetRowStyle(row, style);
|
|
@@ -94,17 +100,13 @@ namespace InABox.DynamicGrid
|
|
|
HiddenColumns = new List<Expression<Func<T, object?>>>();
|
|
|
}
|
|
|
|
|
|
- private void DefaultOptions_OnChanged(object sender, EventArgs args)
|
|
|
- {
|
|
|
- Reconfigure();
|
|
|
- }
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// Initialise things like custom buttons; called once during construction.
|
|
|
/// </summary>
|
|
|
protected abstract void Init();
|
|
|
|
|
|
protected abstract void DoReconfigure(FluentList<DynamicGridOption> options);
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// Configure custom buttons and options.
|
|
|
/// </summary>
|
|
@@ -114,6 +116,11 @@ namespace InABox.DynamicGrid
|
|
|
DoReconfigure(options);
|
|
|
OnReconfigure?.Invoke(options);
|
|
|
options.EndUpdate();
|
|
|
+ if (!_hasLoadedOptions)
|
|
|
+ {
|
|
|
+ _hasLoadedOptions = true;
|
|
|
+ OptionsChanged();
|
|
|
+ }
|
|
|
}
|
|
|
public void Reconfigure()
|
|
|
{
|
|
@@ -206,7 +213,7 @@ namespace InABox.DynamicGrid
|
|
|
OnPrintData?.Invoke(sender);
|
|
|
}
|
|
|
|
|
|
- protected abstract void OptionsChanged(object sender, EventArgs args);
|
|
|
+ protected abstract void OptionsChanged();
|
|
|
|
|
|
public IEnumerable<TType> ExtractValues<TType>(Expression<Func<T, TType>> column, Selection selection)
|
|
|
{
|