浏览代码

Added option to set a fixed height for memo editors

frankvandenbos 3 月之前
父节点
当前提交
e220c6a81e

+ 6 - 1
InABox.Core/Objects/Editors/MemoEditor.cs

@@ -2,9 +2,14 @@
 {
     public class MemoEditor : BaseEditor
     {
+        
+        public double Height { get; set; }
+        
         protected override BaseEditor DoClone()
         {
-            return new MemoEditor();
+            var result = new MemoEditor();
+            result.Height = Height;
+            return result;
         }
     }
 }

+ 11 - 2
inabox.wpf/DynamicGrid/Editors/MemoEditor/MemoEditorControl.cs

@@ -23,7 +23,15 @@ namespace InABox.DynamicGrid
 
         protected override FrameworkElement CreateEditor()
         {
-            MinHeight = 50;
+
+            if (!EditorDefinition.Height.IsEffectivelyEqual(0.00))
+            {
+                MinHeight = EditorDefinition.Height;
+                MaxHeight = EditorDefinition.Height;
+            }
+            else
+                MinHeight = 50;
+
             Editor = new TextBox
             {
                 VerticalAlignment = VerticalAlignment.Stretch,
@@ -31,7 +39,8 @@ namespace InABox.DynamicGrid
                 HorizontalAlignment = HorizontalAlignment.Stretch,
                 VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
                 TextWrapping = TextWrapping.Wrap,
-                AcceptsReturn = true
+                AcceptsReturn = true,
+                
             };
             Editor.TextChanged += (o, e) =>
             {