|
@@ -21,6 +21,7 @@ namespace InABox.DynamicGrid
|
|
|
/// </summary>
|
|
|
public partial class SubQueryNodePopup : ThemableWindow
|
|
|
{
|
|
|
+ private string[] ColumnNames = [];
|
|
|
|
|
|
public Type? QueryType
|
|
|
{
|
|
@@ -42,12 +43,14 @@ namespace InABox.DynamicGrid
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private string? _column;
|
|
|
public string? Column
|
|
|
{
|
|
|
- get => Property.SelectedItem as string;
|
|
|
+ get => _column;
|
|
|
set
|
|
|
{
|
|
|
- Property.SelectedItem = value;
|
|
|
+ _column = value;
|
|
|
+ Property.Content = value.IsNullOrWhiteSpace() ? " " : value;
|
|
|
}
|
|
|
}
|
|
|
public IFilter? Filter
|
|
@@ -106,19 +109,24 @@ namespace InABox.DynamicGrid
|
|
|
private void UpdateQueryType()
|
|
|
{
|
|
|
var type = (Type.SelectedItem as TypeEntry)?.Type;
|
|
|
+ Column = null;
|
|
|
|
|
|
- Property.Items.Clear();
|
|
|
if(type != null)
|
|
|
{
|
|
|
- foreach (var property in CoreUtils.PropertyList(type, x => true, true).Keys)
|
|
|
- {
|
|
|
- Property.Items.Add(property);
|
|
|
- }
|
|
|
Filter = Activator.CreateInstance(typeof(Filter<>).MakeGenericType(type)) as IFilter;
|
|
|
+ Property.IsEnabled = true;
|
|
|
+
|
|
|
+ var properties = DatabaseSchema.Properties(type)
|
|
|
+ .Where(x => x.IsSerializable)
|
|
|
+ .Select(x => x.Name)
|
|
|
+ .ToList();
|
|
|
+ properties.Sort();
|
|
|
+ ColumnNames = properties.ToArray();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
Filter = null;
|
|
|
+ Property.IsEnabled = false;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -149,5 +157,15 @@ namespace InABox.DynamicGrid
|
|
|
DialogResult = true;
|
|
|
Close();
|
|
|
}
|
|
|
+
|
|
|
+ private void Property_Click(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ var type = (Type.SelectedItem as TypeEntry)?.Type;
|
|
|
+
|
|
|
+ if(type is not null && DynamicGridColumnNameSelectorGrid.SelectColumnName(type, ColumnNames, out var value))
|
|
|
+ {
|
|
|
+ Column = value.IsNullOrWhiteSpace() ? null : value;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|