Parcourir la source

Merge remote-tracking branch 'origin/frank' into kenric

Kenric Nugteren il y a 1 an
Parent
commit
f227cc462a

+ 71 - 0
inabox.wpf/DynamicGrid/Editors/FilterEditor/Nodes/ConstantNode.cs

@@ -1,7 +1,10 @@
 using System;
 using System.Collections.Generic;
+using System.Linq;
+using System.Windows;
 using System.Windows.Controls;
 using InABox.Core;
+using Microsoft.Xaml.Behaviors.Core;
 
 namespace InABox.DynamicGrid;
 
@@ -31,4 +34,72 @@ public class ConstantNode : ComboBox
         get => (SelectedItem != null) ? ((KeyValuePair<String,FilterConstant?>)SelectedItem).Value : null;
         set => SelectedValue = value;
     }
+}
+
+public class CustomValueNode : DockPanel
+{
+    private object? _value;
+
+    public FilterConstant[]? Constants { get; set; }
+    
+    public String[]? CustomValues { get; set; }
+    
+    private readonly TextBox _text;
+    private readonly Button _button;
+    
+    public delegate void CustomValueChangedHandler(object value);
+
+    public event CustomValueChangedHandler? CustomValueChanged;
+    
+    public CustomValueNode()
+    {
+
+        _value = null;
+        
+        VerticalAlignment = VerticalAlignment.Stretch;
+        HorizontalAlignment = HorizontalAlignment.Stretch;
+        
+        _button = new Button()
+        {
+            VerticalContentAlignment = VerticalAlignment.Center,
+            Content = "..",
+            Padding = new Thickness(10,0,10,0),
+            Command = new ActionCommand(ShowMenu)
+        };
+        _button.SetValue(DockProperty, Dock.Left);
+        Children.Add(_button);
+
+        _text = new TextBox()
+        {
+            VerticalContentAlignment = VerticalAlignment.Center,
+            Margin = new Thickness(0,0,5,0),
+            Visibility = Visibility.Collapsed
+        };
+        _text.SetValue(DockProperty, Dock.Left);
+        Children.Add(_text);
+        
+
+    }
+
+    private void ShowMenu()
+    {
+        ContextMenu menu = new ContextMenu();
+        bool headers = Constants?.Any() == true && CustomValues?.Any() == true;
+        if (headers)
+        {
+            
+        }
+        else
+        {
+        }
+        MenuItem constantheader = headers
+        ? new MenuItem() { };
+        ContextMenu menu = new ContextMenu();
+    }
+
+    public object? Value
+    {
+        get => _value;
+        set => _value = value;
+    }
 }