Ejemplo n.º 1
0
        /// <summary>
        /// Determines whether the given set of values defines a valid range or not.
        /// A valid range adheres to this constrain: MinValue <= Value <= MaxValue.
        /// </summary>
        /// <param name="range"></param>
        /// <returns></returns>
        bool IsValidRange(LongUpDown range)
        {
            if (range.MinValue <= range.Value && range.Value <= range.MaxValue)
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
        private FrameworkElement GenerateLongUpDown(PropertyInfo property, Binding binding)
        {
#if !SILVERLIGHT
            LongUpDown integerUpDown = new LongUpDown()
            {
                Margin = new Thickness(0, 3, 18, 3)
            };
            integerUpDown.IsReadOnly = !(bindables[property.Name].Direction == BindingDirection.TwoWay);

            if (property.PropertyType == typeof(Int64) || property.PropertyType == typeof(Int64?))
            {
                integerUpDown.Maximum = Int64.MaxValue;
                integerUpDown.Minimum = Int64.MinValue;
            }
            else if (property.PropertyType == typeof(UInt64) || property.PropertyType == typeof(UInt64?))
            {
                integerUpDown.Maximum = Int64.MaxValue;
                integerUpDown.Minimum = 0;
            }
            // Binding
            this.bindings.Add(property.Name, integerUpDown.SetBinding(IntegerUpDown.ValueProperty, binding));
#else
            Border integerUpDown = new Border()
            {
                Opacity = 1.0, Background = new SolidColorBrush(Colors.White), Margin = new Thickness(0, 3, 18, 3)
            };
            NumericUpDown n = new NumericUpDown()
            {
            };
            integerUpDown.Child = n;
            n.IsEnabled         = (bindables[property.Name].Direction == BindingDirection.TwoWay);

            if (property.PropertyType == typeof(Int64) || property.PropertyType == typeof(Int64?))
            {
                n.Maximum = Int64.MaxValue;
                n.Minimum = Int64.MinValue;
            }
            else if (property.PropertyType == typeof(UInt64) || property.PropertyType == typeof(UInt64?))
            {
                n.Maximum = UInt64.MaxValue;
                n.Minimum = UInt64.MinValue;
            }

            // Binding
            this.bindings.Add(property.Name, n.SetBinding(NumericUpDown.ValueProperty, binding));
#endif

            return(integerUpDown);
        }
Ejemplo n.º 3
0
        // TODO: Infer Null value type to handle

        public static FrameworkElement GetBsonValueEditor(
            OpenEditorMode openMode,
            string bindingPath,
            BsonValue bindingValue,
            object bindingSource,
            bool readOnly,
            string keyName)
        {
            var binding = new Binding
            {
                Path                = new PropertyPath(bindingPath),
                Source              = bindingSource,
                Mode                = BindingMode.TwoWay,
                Converter           = new BsonValueToNetValueConverter(),
                UpdateSourceTrigger = UpdateSourceTrigger.Explicit
            };

            if (bindingValue.IsArray)
            {
                var arrayValue = bindingValue as BsonArray;

                if (openMode == OpenEditorMode.Window)
                {
                    var button = new Button
                    {
                        Content = $"[Array] {arrayValue?.Count} {keyName}",
                        Style   = StyleKit.MaterialDesignEntryButtonStyle
                    };

                    button.Click += (s, a) =>
                    {
                        arrayValue = bindingValue as BsonArray;

                        var windowController = new WindowController {
                            Title = "Array Editor"
                        };
                        var control = new ArrayEntryControl(arrayValue, readOnly, windowController);
                        var window  = new DialogWindow(control, windowController)
                        {
                            Owner  = Application.Current.MainWindow,
                            Height = 600
                        };

                        if (window.ShowDialog() == true)
                        {
                            arrayValue?.Clear();
                            arrayValue?.AddRange(control.EditedItems);

                            button.Content = $"[Array] {arrayValue?.Count} {keyName}";
                        }
                    };

                    return(button);
                }

                var contentView = new ContentExpander
                {
                    LoadButton =
                    {
                        Content = $"[Array] {arrayValue?.Count} {keyName}"
                    }
                };

                contentView.LoadButton.Click += (s, a) =>
                {
                    if (contentView.ContentLoaded)
                    {
                        return;
                    }

                    arrayValue = bindingValue as BsonArray;
                    var control = new ArrayEntryControl(arrayValue, readOnly);
                    control.CloseRequested += (sender, args) => { contentView.Content = null; };
                    contentView.Content     = control;
                };

                return(contentView);
            }

            if (bindingValue.IsDocument)
            {
                var expandLabel = "[Document]";
                if (openMode == OpenEditorMode.Window)
                {
                    var button = new Button
                    {
                        Content = expandLabel,
                        Style   = StyleKit.MaterialDesignEntryButtonStyle
                    };

                    button.Click += (s, a) =>
                    {
                        var windowController = new WindowController {
                            Title = "Document Editor"
                        };
                        var bsonDocument = bindingValue as BsonDocument;
                        var control      = new DocumentEntryControl(bsonDocument, readOnly, windowController);
                        var window       = new DialogWindow(control, windowController)
                        {
                            Owner  = Application.Current.MainWindow,
                            Height = 600
                        };

                        window.ShowDialog();
                    };

                    return(button);
                }

                var contentView = new ContentExpander
                {
                    LoadButton =
                    {
                        Content = expandLabel
                    }
                };

                contentView.LoadButton.Click += (s, a) =>
                {
                    if (contentView.ContentLoaded)
                    {
                        return;
                    }

                    var bsonDocument = bindingValue as BsonDocument;
                    var control      = new DocumentEntryControl(bsonDocument, readOnly);
                    control.CloseRequested += (sender, args) => { contentView.Content = null; };

                    contentView.Content = control;
                };

                return(contentView);
            }

            if (bindingValue.IsBoolean)
            {
                var check = new CheckBox
                {
                    IsEnabled         = !readOnly,
                    VerticalAlignment = VerticalAlignment.Center,
                    Margin            = new Thickness(0, 0, 0, 0)
                };

                check.SetBinding(ToggleButton.IsCheckedProperty, binding);
                return(check);
            }

            if (bindingValue.IsDateTime)
            {
                var datePicker = new DateTimePicker
                {
                    TextAlignment     = TextAlignment.Left,
                    IsReadOnly        = readOnly,
                    VerticalAlignment = VerticalAlignment.Center,
                    Margin            = new Thickness(0, 0, 0, 0)
                };

                datePicker.SetBinding(DateTimePicker.ValueProperty, binding);

                return(datePicker);
            }

            if (bindingValue.IsDouble)
            {
                var numberEditor = new DoubleUpDown
                {
                    TextAlignment     = TextAlignment.Left,
                    IsReadOnly        = readOnly,
                    VerticalAlignment = VerticalAlignment.Center,
                    Margin            = new Thickness(0, 0, 0, 0)
                };

                numberEditor.SetBinding(DoubleUpDown.ValueProperty, binding);
                return(numberEditor);
            }

            if (bindingValue.IsDecimal)
            {
                var numberEditor = new DecimalUpDown
                {
                    TextAlignment     = TextAlignment.Left,
                    IsReadOnly        = readOnly,
                    VerticalAlignment = VerticalAlignment.Center,
                    Margin            = new Thickness(0, 0, 0, 0)
                };

                numberEditor.SetBinding(DecimalUpDown.ValueProperty, binding);
                return(numberEditor);
            }

            if (bindingValue.IsInt32)
            {
                var numberEditor = new IntegerUpDown
                {
                    TextAlignment     = TextAlignment.Left,
                    IsReadOnly        = readOnly,
                    VerticalAlignment = VerticalAlignment.Center,
                    Margin            = new Thickness(0, 0, 0, 0)
                };

                numberEditor.SetBinding(IntegerUpDown.ValueProperty, binding);

                return(numberEditor);
            }

            if (bindingValue.IsInt64)
            {
                var numberEditor = new LongUpDown
                {
                    TextAlignment     = TextAlignment.Left,
                    IsReadOnly        = readOnly,
                    VerticalAlignment = VerticalAlignment.Center,
                    Margin            = new Thickness(0, 0, 0, 0)
                };

                numberEditor.SetBinding(LongUpDown.ValueProperty, binding);
                return(numberEditor);
            }

            if (bindingValue.IsString)
            {
                var stringEditor = new TextBox
                {
                    IsReadOnly                  = readOnly,
                    AcceptsReturn               = true,
                    VerticalAlignment           = VerticalAlignment.Center,
                    MaxHeight                   = 200,
                    MaxLength                   = 1024,
                    VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
                };

                stringEditor.SetBinding(TextBox.TextProperty, binding);
                return(stringEditor);
            }

            if (bindingValue.IsBinary)
            {
                var text = new TextBlock
                {
                    Text = "[Binary Data]",
                    VerticalAlignment = VerticalAlignment.Center,
                };

                return(text);
            }

            if (bindingValue.IsObjectId)
            {
                var text = new TextBox
                {
                    Text              = bindingValue.AsString,
                    IsReadOnly        = true,
                    VerticalAlignment = VerticalAlignment.Center,
                };

                return(text);
            }

            var defaultEditor = new TextBox
            {
                VerticalAlignment           = VerticalAlignment.Center,
                MaxHeight                   = 200,
                MaxLength                   = 1024,
                VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
            };

            defaultEditor.SetBinding(TextBox.TextProperty, binding);
            return(defaultEditor);
        }
Ejemplo n.º 4
0
        private void UpdateControls()
        {
            if (String.IsNullOrWhiteSpace(VariableTitle))
            {
                this.txtBlk_name.Visibility = Visibility.Collapsed;
            }
            else
            {
                this.txtBlk_name.Visibility = Visibility.Visible;
                this.txtBlk_name.Text       = VariableTitle;
            }

            if (String.IsNullOrWhiteSpace(VariableRemark))
            {
                this.txtBlk_remark.Visibility = Visibility.Collapsed;
            }
            else
            {
                this.txtBlk_remark.Visibility = Visibility.Visible;
                this.txtBlk_remark.Text       = VariableRemark;
            }

            if (VariableDefaultObject == null)
            {
                this.btn_reset.Visibility = Visibility.Collapsed;
            }
            else
            {
                this.btn_reset.Visibility = Visibility.Visible;
            }

            //Create a control here...
            grd_control.Children.Clear();

            if (VariableObject != null)
            {
                Type var_type = VariableObject.GetType();

                if (var_type == typeof(bool))
                {
                    CheckBox chkbx_control = new CheckBox();
                    chkbx_control.Content    = "";
                    chkbx_control.IsChecked  = (bool)VariableObject;
                    chkbx_control.Checked   += Chkbx_control_VarChanged;
                    chkbx_control.Unchecked += Chkbx_control_VarChanged;

                    grd_control.Children.Add(chkbx_control);
                }
                else if (var_type == typeof(string))
                {
                    TextBox txtbx_control = new TextBox();
                    txtbx_control.Text         = (string)VariableObject;
                    txtbx_control.TextChanged += Txtbx_control_TextChanged;

                    grd_control.Children.Add(txtbx_control);
                }
                else if (var_type == typeof(int))
                {
                    IntegerUpDown intUpDown_control = new IntegerUpDown();
                    intUpDown_control.Value         = (int)VariableObject;
                    intUpDown_control.ValueChanged += IntUpDown_control_ValueChanged;

                    grd_control.Children.Add(intUpDown_control);
                }
                else if (var_type == typeof(long))
                {
                    LongUpDown longUpDown_control = new LongUpDown();
                    longUpDown_control.Value         = (long)VariableObject;
                    longUpDown_control.ValueChanged += LongUpDown_control_ValueChanged;

                    grd_control.Children.Add(longUpDown_control);
                }
                else if (var_type == typeof(float))
                {
                    DoubleUpDown floatUpDown_control = new DoubleUpDown();
                    floatUpDown_control.Value         = (float)VariableObject;
                    floatUpDown_control.ValueChanged += FloatUpDown_control_ValueChanged;

                    grd_control.Children.Add(floatUpDown_control);
                }
                else if (var_type == typeof(double))
                {
                    DoubleUpDown doubleUpDown_control = new DoubleUpDown();
                    doubleUpDown_control.Value         = (double)VariableObject;
                    doubleUpDown_control.ValueChanged += DoubleUpDown_control_ValueChanged;

                    grd_control.Children.Add(doubleUpDown_control);
                }
                else if (var_type == typeof(System.Drawing.Color))
                {
                    ColorPicker colorPickerDrawing_control = new ColorPicker();
                    colorPickerDrawing_control.SelectedColor         = Utils.ColorUtils.DrawingColorToMediaColor((System.Drawing.Color)VariableObject);
                    colorPickerDrawing_control.ColorMode             = ColorMode.ColorCanvas;
                    colorPickerDrawing_control.SelectedColorChanged += ColorPickerDrawing_control_SelectedColorChanged;

                    grd_control.Children.Add(colorPickerDrawing_control);
                }
                else if (var_type == typeof(System.Windows.Media.Color))
                {
                    ColorPicker colorPickerMedia_control = new ColorPicker();
                    colorPickerMedia_control.SelectedColor         = (System.Windows.Media.Color)VariableObject;
                    colorPickerMedia_control.ColorMode             = ColorMode.ColorCanvas;
                    colorPickerMedia_control.SelectedColorChanged += ColorPickerMedia_control_SelectedColorChanged;

                    grd_control.Children.Add(colorPickerMedia_control);
                }
                else if (var_type == typeof(Aurora.Settings.KeySequence))
                {
                    Aurora.Controls.KeySequence ctrl = new Aurora.Controls.KeySequence();
                    ctrl.Sequence         = (Aurora.Settings.KeySequence)VariableObject;
                    ctrl.SequenceUpdated += keySequenceControlValueChanged;
                    ctrl.RecordingTag     = VariableTitle;

                    grd_control.Children.Add(ctrl);
                }
                else if (var_type == typeof(Aurora.Utils.RealColor))
                {
                    ColorPicker ctrl = new ColorPicker();
                    ctrl.ColorMode = ColorMode.ColorCanvas;
                    Aurora.Utils.RealColor clr = (Aurora.Utils.RealColor)VariableObject;

                    ctrl.SelectedColor         = clr.GetMediaColor();
                    ctrl.SelectedColorChanged += colorPickerControlValueChanged;
                    grd_control.Children.Add(ctrl);
                }
                else if (var_type.IsEnum)
                {
                    ComboBox cmbbxEnum_control = new ComboBox();
                    cmbbxEnum_control.ItemsSource       = Enum.GetValues(var_type);
                    cmbbxEnum_control.SelectedValue     = (Enum)VariableObject;
                    cmbbxEnum_control.SelectionChanged += CmbbxEnum_control_SelectionChanged;

                    grd_control.Children.Add(cmbbxEnum_control);
                }
            }

            grd_control.UpdateLayout();
        }
        private void UpdateControls()
        {
            string var_title = VarRegistry.GetTitle(VariableName);

            if (String.IsNullOrWhiteSpace(var_title))
            {
                this.txtBlk_name.Text = VariableName;
            }
            else
            {
                this.txtBlk_name.Text = var_title;
            }

            string var_remark = VarRegistry.GetRemark(VariableName);

            if (String.IsNullOrWhiteSpace(var_remark))
            {
                this.txtBlk_remark.Visibility = Visibility.Collapsed;
            }
            else
            {
                this.txtBlk_remark.Text = var_remark;
            }

            //Create a control here...
            Type var_type = VarRegistry.GetVariableType(VariableName);

            grd_control.Children.Clear();

            if (var_type == typeof(bool))
            {
                CheckBox chkbx_control = new CheckBox();
                chkbx_control.Content    = "";
                chkbx_control.IsChecked  = VarRegistry.GetVariable <bool>(VariableName);
                chkbx_control.Checked   += Chkbx_control_VarChanged;
                chkbx_control.Unchecked += Chkbx_control_VarChanged;

                grd_control.Children.Add(chkbx_control);
            }
            else if (var_type == typeof(string))
            {
                TextBox txtbx_control = new TextBox();
                txtbx_control.Text         = VarRegistry.GetVariable <string>(VariableName);
                txtbx_control.TextChanged += Txtbx_control_TextChanged;

                grd_control.Children.Add(txtbx_control);
            }
            else if (var_type == typeof(int))
            {
                if (VarRegistry.GetFlags(VariableName).HasFlag(VariableFlags.UseHEX))
                {
                    TextBox hexBox = new TextBox();
                    hexBox.PreviewTextInput += HexBoxOnPreviewTextInput;
                    hexBox.Text              = string.Format("{0:X}", VarRegistry.GetVariable <int>(VariableName));
                    hexBox.TextChanged      += HexBox_TextChanged;
                    grd_control.Children.Add(hexBox);
                }
                else
                {
                    IntegerUpDown intUpDown_control = new IntegerUpDown();

                    intUpDown_control.Value = VarRegistry.GetVariable <int>(VariableName);
                    int max_val, min_val = 0;
                    if (VarRegistry.GetVariableMax <int>(VariableName, out max_val))
                    {
                        intUpDown_control.Maximum = max_val;
                    }
                    if (VarRegistry.GetVariableMin <int>(VariableName, out min_val))
                    {
                        intUpDown_control.Minimum = min_val;
                    }

                    intUpDown_control.ValueChanged += IntUpDown_control_ValueChanged;

                    grd_control.Children.Add(intUpDown_control);
                }
            }
            else if (var_type == typeof(long))
            {
                LongUpDown longUpDown_control = new LongUpDown();
                longUpDown_control.Value = VarRegistry.GetVariable <long>(VariableName);
                long max_val, min_val = 0;
                if (VarRegistry.GetVariableMax <long>(VariableName, out max_val))
                {
                    longUpDown_control.Maximum = max_val;
                }
                if (VarRegistry.GetVariableMin <long>(VariableName, out min_val))
                {
                    longUpDown_control.Minimum = min_val;
                }

                longUpDown_control.ValueChanged += LongUpDown_control_ValueChanged;

                grd_control.Children.Add(longUpDown_control);
            }
            else if (var_type == typeof(Aurora.Settings.KeySequence))
            {
                Aurora.Controls.KeySequence ctrl = new Aurora.Controls.KeySequence();
                ctrl.RecordingTag = var_title;

                ctrl.Sequence         = VarRegistry.GetVariable <Aurora.Settings.KeySequence>(VariableName);
                ctrl.SequenceUpdated += keySequenceControlValueChanged;

                grd_control.Children.Add(ctrl);
            }
            else if (var_type == typeof(Aurora.Utils.RealColor))
            {
                ColorPicker ctrl = new ColorPicker();
                ctrl.ColorMode = ColorMode.ColorCanvas;
                Aurora.Utils.RealColor clr = VarRegistry.GetVariable <Aurora.Utils.RealColor>(VariableName);

                ctrl.SelectedColor         = clr.GetMediaColor();
                ctrl.SelectedColorChanged += colorPickerControlValueChanged;
                grd_control.Children.Add(ctrl);
            }
            //else
            //throw new Exception($"Type {var_type} is not supported!");

            grd_control.UpdateLayout();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Tests all permutions for all sequences of three elements.
        /// </summary>
        /// <param name="min"></param>
        /// <param name="val"></param>
        /// <param name="max"></param>
        public void TestAllPermutations(long min, long val, long max)
        {
            string[,] ctrl = new string[6, 3]
            {
                { "min", "val", "max" },
                { "val", "min", "max" },
                { "val", "max", "min" },
                { "val", "min", "max" },
                { "min", "max", "val" },
                { "max", "min", "val" },
            };

            for (int i = 0; i < 6; i++)
            {
                var    range           = new LongUpDown();
                string testPermutation = "";

                for (int j = 0; j < 3; j++)
                {
                    var itemToSet = ctrl[i, j];

                    if (string.IsNullOrEmpty(testPermutation))
                    {
                        testPermutation = itemToSet;
                    }
                    else
                    {
                        testPermutation += ", " + itemToSet;
                    }

                    switch (itemToSet)
                    {
                    case "min":
                        range.MinValue = min;
                        Assert.IsTrue(IsValidRange(range));
                        break;

                    case "val":
                        range.Value = val;
                        Assert.IsTrue(IsValidRange(range));
                        break;

                    case "max":
                        range.MaxValue = max;
                        Assert.IsTrue(IsValidRange(range));
                        break;

                    default:
                        break;
                    }
                }

                Console.WriteLine("Testing Permutation {0}: {1} - min={2}, val={3}, max={4}", i, testPermutation, min, val, max);
                Assert.IsTrue(IsValidRange(range));

                Assert.IsTrue(range.MinValue == min);
                Assert.IsTrue(range.Value == val);
                Assert.IsTrue(range.MaxValue == max);

                // Test if increment command works as expected
                while (range.MaxValue > range.Value)
                {
                    Assert.IsTrue(InputBaseUpDown.IncreaseCommand.CanExecute(null, range));
                    InputBaseUpDown.IncreaseCommand.Execute(null, range);
                }
                Assert.IsTrue(range.MaxValue == range.Value);

                // Test if decrement command works as expected
                while (range.MinValue < range.Value)
                {
                    Assert.IsTrue(InputBaseUpDown.DecreaseCommand.CanExecute(null, range));
                    InputBaseUpDown.DecreaseCommand.Execute(null, range);
                }
                Assert.IsTrue(range.MinValue == range.Value);
            }
        }
Ejemplo n.º 7
0
        public static FrameworkElement GetBsonValueEditor(string bindingPath, BsonValue bindingValue, object bindingSource, bool readOnly)
        {
            var binding = new Binding()
            {
                Path                = new PropertyPath(bindingPath),
                Source              = bindingSource,
                Mode                = BindingMode.TwoWay,
                Converter           = new BsonValueToNetValueConverter(),
                UpdateSourceTrigger = UpdateSourceTrigger.Explicit
            };

            if (bindingValue.IsArray)
            {
                var button = new Button()
                {
                    Content = "Array"
                };

                button.Click += (s, a) =>
                {
                    var arrayValue = bindingValue as BsonArray;
                    var window     = new Windows.ArrayViewer(arrayValue, readOnly)
                    {
                        Owner = Application.Current.MainWindow
                    };

                    if (window.ShowDialog() == true)
                    {
                        arrayValue.Clear();
                        arrayValue.AddRange(window.EditedItems);
                    }
                };

                return(button);
            }
            else if (bindingValue.IsBoolean)
            {
                var check = new CheckBox()
                {
                    IsEnabled = !readOnly
                };

                check.SetBinding(ToggleButton.IsCheckedProperty, binding);
                return(check);
            }
            else if (bindingValue.IsDateTime)
            {
                var datePicker = new DateTimePicker()
                {
                    TextAlignment = TextAlignment.Left,
                    IsReadOnly    = readOnly
                };

                datePicker.SetBinding(DateTimePicker.ValueProperty, binding);
                return(datePicker);
            }
            else if (bindingValue.IsDocument)
            {
                var button = new Button()
                {
                    Content = "Document"
                };

                button.Click += (s, a) =>
                {
                    var window = new Windows.DocumentViewer(bindingValue as BsonDocument, readOnly)
                    {
                        Owner = Application.Current.MainWindow
                    };

                    window.ShowDialog();
                };

                return(button);
            }
            else if (bindingValue.IsDouble)
            {
                var numberEditor = new DoubleUpDown()
                {
                    TextAlignment = TextAlignment.Left,
                    IsReadOnly    = readOnly
                };

                numberEditor.SetBinding(DoubleUpDown.ValueProperty, binding);
                return(numberEditor);
            }
            else if (bindingValue.IsInt32)
            {
                var numberEditor = new IntegerUpDown()
                {
                    TextAlignment = TextAlignment.Left,
                    IsReadOnly    = readOnly
                };

                numberEditor.SetBinding(IntegerUpDown.ValueProperty, binding);
                return(numberEditor);
            }
            else if (bindingValue.IsInt64)
            {
                var numberEditor = new LongUpDown()
                {
                    TextAlignment = TextAlignment.Left,
                    IsReadOnly    = readOnly
                };

                numberEditor.SetBinding(LongUpDown.ValueProperty, binding);
                return(numberEditor);
            }
            else if (bindingValue.IsString)
            {
                var stringEditor = new TextBox()
                {
                    IsReadOnly    = readOnly,
                    AcceptsReturn = true
                };

                stringEditor.SetBinding(TextBox.TextProperty, binding);
                return(stringEditor);
            }
            else if (bindingValue.IsBinary)
            {
                var text = new TextBlock()
                {
                    Text = "[Binary Data]"
                };

                return(text);
            }
            else if (bindingValue.IsObjectId)
            {
                var text = new TextBlock()
                {
                    Text      = bindingValue.AsString,
                    IsEnabled = false
                };

                return(text);
            }
            else
            {
                var stringEditor = new TextBox();
                stringEditor.SetBinding(TextBox.TextProperty, binding);
                return(stringEditor);
            }
        }