|
@@ -1,3 +1,4 @@
|
|
|
+using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.ComponentModel;
|
|
|
using System.Linq;
|
|
@@ -5,6 +6,7 @@ using System.Windows;
|
|
|
using System.Windows.Controls;
|
|
|
using System.Windows.Media;
|
|
|
using InABox.Core;
|
|
|
+using RoslynPad.Editor;
|
|
|
|
|
|
namespace InABox.DynamicGrid
|
|
|
{
|
|
@@ -42,6 +44,8 @@ namespace InABox.DynamicGrid
|
|
|
get => (string)GetValue(ColumnNameProperty);
|
|
|
set => SetValue(ColumnNameProperty, value);
|
|
|
}
|
|
|
+
|
|
|
+ protected TextBox? Information { get; private set; }
|
|
|
|
|
|
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
|
|
public IBaseEditor EditorDefinition
|
|
@@ -50,11 +54,44 @@ namespace InABox.DynamicGrid
|
|
|
set
|
|
|
{
|
|
|
_editordefinition = value;
|
|
|
- Content = CreateEditor();
|
|
|
+
|
|
|
+ if (_editordefinition.Information != null)
|
|
|
+ {
|
|
|
+ DockPanel _dock = new DockPanel();
|
|
|
+ var _editor = CreateEditor();
|
|
|
+ _editor.SetValue(DockPanel.DockProperty, Dock.Left);
|
|
|
+ _dock.Children.Add(_editor);
|
|
|
+ Information = new TextBox()
|
|
|
+ {
|
|
|
+ VerticalAlignment = VerticalAlignment.Stretch,
|
|
|
+ VerticalContentAlignment = VerticalAlignment.Center,
|
|
|
+ HorizontalAlignment = HorizontalAlignment.Stretch,
|
|
|
+ Margin = new Thickness(5, 0, 0, 0),
|
|
|
+ IsReadOnly = true,
|
|
|
+ Focusable = false,
|
|
|
+ Background = new SolidColorBrush(Colors.WhiteSmoke),
|
|
|
+ BorderBrush = new SolidColorBrush(Colors.Silver)
|
|
|
+ };
|
|
|
+ Information.SetValue(DockPanel.DockProperty, Dock.Left);
|
|
|
+ _dock.Children.Add(Information);
|
|
|
+ Content = _dock;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ Content = CreateEditor();
|
|
|
+
|
|
|
SetColor(Color);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ protected void UpdateInformation()
|
|
|
+ {
|
|
|
+ if (EditorDefinition?.Information != null && Information != null)
|
|
|
+ {
|
|
|
+ var _info = Activator.CreateInstance(EditorDefinition.Information) as IEditorInformation;
|
|
|
+ Information.Text = _info?.Display(Host.GetItems()) ?? "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
|
|
public bool Loaded { get; set; }
|
|
|
|
|
@@ -72,8 +109,11 @@ namespace InABox.DynamicGrid
|
|
|
|
|
|
public abstract void SetVisible(bool visible);
|
|
|
|
|
|
- public abstract void SetValue(string property, object? value);
|
|
|
-
|
|
|
+ public virtual void SetValue(string property, object? value)
|
|
|
+ {
|
|
|
+ UpdateInformation();
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
@@ -145,8 +185,10 @@ namespace InABox.DynamicGrid
|
|
|
}
|
|
|
return buttons;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public abstract class BaseDynamicEditorControl<TEditor> : BaseDynamicEditorControl
|
|
|
where TEditor : IBaseEditor
|
|
|
{
|