12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- using com.sun.org.apache.xpath.@internal.operations;
- using FastReport.DevComponents.Editors;
- using InABox.Core;
- using InABox.Wpf;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- namespace InABox.DynamicGrid;
- public interface IDynamicFormWindow
- {
- DynamicFormDesignGrid Grid { get; }
- }
- public static class DynamicFormWindowExtensions
- {
- public static void LoadLayout(this IDynamicFormWindow window, DigitalFormLayout layout, IList<DigitalFormVariable> variables)
- {
- window.Grid.Variables = variables;
- var f = new DFLayout();
- if (!string.IsNullOrWhiteSpace(layout.Layout))
- {
- f.LoadLayout(layout.Layout);
- }
- else
- {
- f = new DFLayout();
- f.RowHeights.Add("Auto");
- f.ColumnWidths.AddRange(new[] { "*", "Auto" });
- }
- f.LoadVariables(variables);
- window.Grid.Form = f;
- }
- /// <summary>
- /// Renders the form; after this is called, any changes to properties triggers a refresh.
- /// </summary>
- public static void Initialize(this IDynamicFormWindow window)
- {
- window.Grid.Initialize();
- }
- }
|