|
@@ -11,17 +11,26 @@ using System.Text;
|
|
|
using System.Threading;
|
|
|
using System.Threading.Tasks;
|
|
|
using System.Windows;
|
|
|
+using System.Windows.Controls;
|
|
|
|
|
|
namespace PRSDesktop;
|
|
|
|
|
|
public class ProductGroupTree : DynamicDataGrid<ProductGroup>
|
|
|
{
|
|
|
public Guid SelectedID { get; private set; }
|
|
|
+
|
|
|
+ private Button _expandorcollapseAll;
|
|
|
+
|
|
|
+ public ProductGroupTree() : base()
|
|
|
+ {
|
|
|
+ _expandorcollapseAll = AddButton("Collapse All", null, ExpandOrCollapseAll);
|
|
|
+ }
|
|
|
|
|
|
protected override void DoReconfigure(DynamicGridOptions options)
|
|
|
{
|
|
|
base.DoReconfigure(options);
|
|
|
-
|
|
|
+ options.FilterRows = true;
|
|
|
+ options.HideDatabaseFilters = true;
|
|
|
options.SelectColumns = false;
|
|
|
options.ImportData = false;
|
|
|
options.ExportData = false;
|
|
@@ -33,6 +42,26 @@ public class ProductGroupTree : DynamicDataGrid<ProductGroup>
|
|
|
columns.Add<ProductGroup>(x => x.Description, 0, "Description", "", Alignment.MiddleLeft);
|
|
|
return columns;
|
|
|
}
|
|
|
+
|
|
|
+ private bool ExpandOrCollapseAll(Button button, CoreRow[] rows)
|
|
|
+ {
|
|
|
+ if (_uiComponent == null)
|
|
|
+ return false;
|
|
|
+
|
|
|
+ if (_uiComponent.Collapsed())
|
|
|
+ {
|
|
|
+ _uiComponent.ExpandAll();
|
|
|
+ UpdateButton(_expandorcollapseAll, null, "Collapse All", null);
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _uiComponent.CollapseAll();
|
|
|
+ UpdateButton(_expandorcollapseAll, null, "Expand All", null);
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
private DynamicGridTreeUIComponent<ProductGroup, Guid>? _uiComponent;
|
|
|
private DynamicGridTreeUIComponent<ProductGroup, Guid> UIComponent
|