| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using Comal.Classes;
- using InABox.Core;
- using InABox.DynamicGrid;
- using InABox.WPF;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Media.Imaging;
- namespace PRSDesktop;
- public class StockSummaryProductGroupTree : DynamicSelectorGrid<ProductGroup>, ISpecificGrid
- {
- public StockSummaryProductGroupTree() : base(DynamicActionColumnPosition.End)
- {
- ColumnsTag = "StockSummaryProductGroupSelector";
- }
- public override DynamicGridColumns GenerateColumns()
- {
- var columns = new DynamicGridColumns();
- columns.Add<ProductGroup, string>(x => x.Description, 0, "Description", "", Alignment.MiddleLeft);
- return columns;
- }
- public IEnumerable<Guid> GetSelectedGroups(bool recursive) =>
- recursive
- ? SelectedIDs.SelectMany(x => UIComponent.GetChildren(x).Select(x => x.Get<ProductGroup, Guid>(x => x.ID)))
- : SelectedIDs;
- private DynamicGridTreeUIComponent<ProductGroup>? _uiComponent;
- private DynamicGridTreeUIComponent<ProductGroup> UIComponent
- {
- get
- {
- if(_uiComponent is null)
- {
- _uiComponent = new DynamicGridTreeUIComponent<ProductGroup>(
- x => x.ID,
- x => x.Parent.ID)
- {
- Parent = this,
- ExpandMode = DynamicTreeGridExpandMode.All
- };
- }
- return _uiComponent;
- }
- }
- protected override IDynamicGridUIComponent<ProductGroup> CreateUIComponent()
- {
- return UIComponent;
- }
- }
|