|
@@ -37,7 +37,7 @@ public class DynamicGridColumnNameSelectorGrid : DynamicItemsListGrid<DynamicGri
|
|
|
|
|
|
public string SearchText { get; set; }
|
|
|
|
|
|
- public DynamicGridColumnNameSelectorGrid(string[] columnNames)
|
|
|
+ public DynamicGridColumnNameSelectorGrid(Type type, string[] columnNames)
|
|
|
{
|
|
|
var items = new List<DynamicGridColumnNameSelectorItem>();
|
|
|
var parentCols = new HashSet<string>();
|
|
@@ -63,7 +63,8 @@ public class DynamicGridColumnNameSelectorGrid : DynamicItemsListGrid<DynamicGri
|
|
|
ColumnName = column,
|
|
|
ParentColumn = parent,
|
|
|
Display = props[^1],
|
|
|
- IsParent = false
|
|
|
+ IsParent = false,
|
|
|
+ Comment = DatabaseSchema.Property(type, column)?.Comment ?? ""
|
|
|
};
|
|
|
items.Add(item);
|
|
|
}
|
|
@@ -74,7 +75,8 @@ public class DynamicGridColumnNameSelectorGrid : DynamicItemsListGrid<DynamicGri
|
|
|
var item = new DynamicGridColumnNameSelectorItem
|
|
|
{
|
|
|
ColumnName = col,
|
|
|
- IsParent = true
|
|
|
+ IsParent = true,
|
|
|
+ Comment = DatabaseSchema.Property(type, col)?.Comment ?? ""
|
|
|
};
|
|
|
if (lastColIdx == -1)
|
|
|
{
|
|
@@ -116,7 +118,8 @@ public class DynamicGridColumnNameSelectorGrid : DynamicItemsListGrid<DynamicGri
|
|
|
protected override DynamicGridColumns LoadColumns()
|
|
|
{
|
|
|
var columns = new DynamicGridColumns<DynamicGridColumnNameSelectorItem>();
|
|
|
- columns.Add(x => x.Display, caption: "Name");
|
|
|
+ columns.Add(x => x.Display, caption: "Name", width: 250);
|
|
|
+ columns.Add(x => x.Comment);
|
|
|
return columns;
|
|
|
}
|
|
|
|
|
@@ -140,31 +143,46 @@ public class DynamicGridColumnNameSelectorGrid : DynamicItemsListGrid<DynamicGri
|
|
|
ExpandMode = DynamicTreeGridExpandMode.None;
|
|
|
ShowHeader = false;
|
|
|
MinRowHeight = 25;
|
|
|
+ GridLines = DynamicTreeGridLines.Horizontal;
|
|
|
}
|
|
|
|
|
|
protected override Brush? GetCellForeground(CoreRow row, DynamicColumnBase column)
|
|
|
{
|
|
|
- var item = Grid.LoadItem(row);
|
|
|
- if (item.IsParent)
|
|
|
+ if(column is DynamicGridColumn gc && gc.ColumnName == nameof(DynamicGridColumnNameSelectorItem.Comment))
|
|
|
{
|
|
|
return Colors.Gray.ToBrush();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- return base.GetCellForeground(row, column);
|
|
|
+ var item = Grid.LoadItem(row);
|
|
|
+ if (item.IsParent)
|
|
|
+ {
|
|
|
+ return Colors.Gray.ToBrush();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return base.GetCellForeground(row, column);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
protected override FontStyle? GetCellFontStyle(CoreRow row, DynamicColumnBase column)
|
|
|
{
|
|
|
- var item = Grid.LoadItem(row);
|
|
|
- if (item.IsParent)
|
|
|
+ if(column is DynamicGridColumn gc && gc.ColumnName == nameof(DynamicGridColumnNameSelectorItem.Comment))
|
|
|
{
|
|
|
return FontStyles.Italic;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- return base.GetCellFontStyle(row, column);
|
|
|
+ var item = Grid.LoadItem(row);
|
|
|
+ if (item.IsParent)
|
|
|
+ {
|
|
|
+ return FontStyles.Italic;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return base.GetCellFontStyle(row, column);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -205,9 +223,9 @@ public class DynamicGridColumnNameSelectorGrid : DynamicItemsListGrid<DynamicGri
|
|
|
base.Reload(criteria, columns, ref sort, token, action);
|
|
|
}
|
|
|
|
|
|
- public static bool SelectColumnName(string[] columnNames, out string value)
|
|
|
+ public static bool SelectColumnName(Type type, string[] columnNames, out string value)
|
|
|
{
|
|
|
- var grid = new DynamicGridColumnNameSelectorGrid(columnNames)
|
|
|
+ var grid = new DynamicGridColumnNameSelectorGrid(type, columnNames)
|
|
|
{
|
|
|
};
|
|
|
grid.Refresh(true, true);
|
|
@@ -245,8 +263,9 @@ public class DynamicGridColumnNameSelectorGrid : DynamicItemsListGrid<DynamicGri
|
|
|
var window = new DynamicContentDialog(control)
|
|
|
{
|
|
|
Title = "Select Column",
|
|
|
- Width = 400,
|
|
|
- Height = 600
|
|
|
+ Width = 600,
|
|
|
+ Height = 600,
|
|
|
+ WindowStartupLocation = WindowStartupLocation.CenterScreen
|
|
|
};
|
|
|
window.Bind(DynamicContentDialog.CanSaveProperty, grid, x => x.CanSave);
|
|
|
|
|
@@ -283,5 +302,7 @@ public class DynamicGridColumnNameSelectorItem : BaseObject
|
|
|
|
|
|
public string? ParentColumn { get; set; }
|
|
|
|
|
|
+ public string Comment { get; set; } = "";
|
|
|
+
|
|
|
public bool IsParent { get; set; }
|
|
|
}
|