예제 #1
0
 void LoadBoolUI()
 {
     if (IsSwitch)
     {
         ToggleSwitch ts = new ToggleSwitch {
             MinWidth = 100, HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Center
         };
         Binding bind = new Binding {
             Path = new PropertyPath("ReadOnlyBinding"), Converter = new BoolToggleConverter(), Source = this
         };
         ts.SetBinding(ToggleSwitch.IsEnabledProperty, bind);
         if (_isLoaded)
         {
             ts.SetBinding(ToggleSwitch.IsOnProperty, ValBinding);
         }
         _panel.Child = ts;
     }
     else
     {
         CheckBox cb = new CheckBox {
             MinWidth = 30, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center
         };
         Binding bind = new Binding {
             Path = new PropertyPath("ReadOnlyBinding"), Converter = new BoolToggleConverter(), Source = this
         };
         cb.SetBinding(CheckBox.IsEnabledProperty, bind);
         if (_isLoaded)
         {
             cb.SetBinding(CheckBox.IsCheckedProperty, ValBinding);
         }
         _panel.Child = cb;
     }
 }
예제 #2
0
        public BoolSwitch()
        {
            s = new ToggleSwitch()
            {
                HorizontalAlignment       = HorizontalAlignment.Center,
                SwitchHorizontalAlignment = HorizontalAlignment.Center,
                HeaderContentPlacement    = Dock.Top,
                CheckedText          = "",
                UncheckedText        = "",
                SwitchPadding        = new Thickness(0),
                BorderThickness      = new Thickness(2),
                FontSize             = 11.5,
                UncheckedBorderBrush = new SolidColorBrush(Colors.Black)
            };
            Content = s;
            //100x50
            TileGrid.SetColumnSpan(this, 2);
            TileGrid.SetRowSpan(this, 1);

            //bind some properties
            s.SetBinding(ToggleSwitch.CheckedBackgroundProperty, s, "CheckedBorderBrush");
            s.SetBinding(ToggleSwitch.CheckedBorderBrushProperty, this, "CheckedColor");
            s.SetBinding(ToggleSwitch.ContentProperty, this, "Text");

            SourceChanged += BoolSwitch_SourceChanged;
        }
예제 #3
0
        /// <summary>
        /// Makes the toggle switch.
        /// </summary>
        /// <param name="setting">The setting.</param>
        /// <returns>ToggleSwitch.</returns>
        private static ToggleSwitch MakeToggleSwitch(Setting setting)
        {
            var tsOption = new ToggleSwitch {
                Name = String.Format((string)"ts{0}", (object)setting.Name.Replace(" ", String.Empty)), Header = setting.FriendlyName
            };

            tsOption.SetBinding(ToggleSwitch.IsCheckedProperty, new Binding("Value")
            {
                Mode = BindingMode.TwoWay, Source = setting
            });
            return(tsOption);
        }
예제 #4
0
        public MainPage()
        {
            InitializeComponent();

            ToggleSwitch.BindingContext  = DataModel;
            MessageButton.BindingContext = DataModel;
            MessageLabel.BindingContext  = DataModel;

            ToggleSwitch.SetBinding(Switch.IsToggledProperty, "IsTrue", BindingMode.OneWayToSource);
            MessageButton.SetBinding(Button.IsEnabledProperty, "IsTrue", BindingMode.OneWay);
            MessageLabel.SetBinding(Label.IsVisibleProperty, "IsTrue", BindingMode.OneWay);
            MessageLabel.SetBinding(Label.TextProperty, "CurrentSaying", BindingMode.OneWay);
        }
예제 #5
0
        public MainPage()
        {
            InitializeComponent();


            ToggleSwitch.BindingContext = DataModel;
            btnNumber.BindingContext    = DataModel;
            lblHideMe.BindingContext    = DataModel;
            lbl1.BindingContext         = DataModel;

            ToggleSwitch.SetBinding(Switch.IsToggledProperty, "IsTrue", BindingMode.OneWayToSource);
            btnNumber.SetBinding(Button.IsEnabledProperty, "IsTrue", BindingMode.OneWay);

            lbl1.SetBinding(Label.TextProperty, "NumberAsString", BindingMode.OneWay);
        }
예제 #6
0
        public MainPage()
        {
            InitializeComponent();

            //BindingContext is the same for all elements, so can use the containing view

            //ToggleSwitch.BindingContext = ViewModel;
            //MessageButton.BindingContext = ViewModel;
            //MessageLabel.BindingContext = ViewModel;
            BindingContext = ViewModel;

            ToggleSwitch.SetBinding(Switch.IsToggledProperty, "UIVisible", BindingMode.OneWayToSource);
            MessageButton.SetBinding(Button.TextProperty, "SayingNumber", BindingMode.OneWay, null, "Saying: {0:d}");
            MessageButton.SetBinding(Button.CommandProperty, "ButtonCommand");

            MessageLabel.SetBinding(Label.TextProperty, "CurrentSaying", BindingMode.OneWay);
            MessageLabel.SetBinding(Label.IsVisibleProperty, "UIVisible", BindingMode.OneWay);
            MessageLabel.SetBinding(Label.TextColorProperty, "SayingNumber", BindingMode.OneWay, new ColorConverter());
        }
예제 #7
0
        static FrameworkElement GetUIOptionValue(int opt, JObject root)
        {
            Option option = (Option)opt;

            JProperty        jprop = GetJProperty(option, root);
            FrameworkElement ret   = null;

            try
            {
                switch (option)
                {
                case Option.encode_type:
                {
                    Dictionary <string, int> dic = new Dictionary <string, int>()
                    {
                        { "binary", 0 }
                        , { "ASCII", 1 }
                    };
                    ComboBox cb = new ComboBox()
                    {
                        SelectedIndex = 0
                    };
                    var e = dic.GetEnumerator();
                    while (e.MoveNext())
                    {
                        cb.Items.Add(e.Current.Key);
                    }


                    cb.DataContext = jprop.Parent;
                    Binding bd = new Binding(option.ToString());
                    bd.Mode      = BindingMode.TwoWay;
                    bd.Converter = new StringToInt64Converter();
                    cb.SetBinding(ComboBox.SelectedIndexProperty, bd);

                    cb.SelectedIndex = Convert.ToInt32(jprop.Value);

                    cb.SelectionChanged += delegate
                    {
                        ConfigOptionManager.IsChanged = true;
                    };
                    ret = cb;
                }
                break;

                case Option.sid:
                case Option.item:
                case Option.schedule_time:
                case Option.delay_time:
                {
                    TextBox tb = new TextBox() /*Text = optionValue.ToString()*/ }
                    {
                        ;
                        tb.Width = ConfigOptionSize.WIDTH_VALUE;
                        tb.HorizontalAlignment = HorizontalAlignment.Left;
                        ret = tb;

                        tb.DataContext = jprop.Parent;
                        Binding bd = new Binding(option.ToString());
                        bd.Mode = BindingMode.TwoWay;
                        // TextBox.Text 의 UpdateSourceTrigger 의 기본속성은 LostFocus 이다.
                        bd.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
                        tb.SetBinding(TextBox.TextProperty, bd);

                        tb.Text = Convert.ToString(jprop.Value);

                        tb.TextChanged += delegate
                        {
                            //((JValue)optionValue).Value = tb.Text;
                            ConfigOptionManager.IsChanged = true;
                        };
                }
                break;

                case Option.log_console_yn:
                case Option.header_file_save_yn:
                case Option.file_reserver_yn:
                case Option.dir_monitoring_yn:
                case Option.verify_yn:
                case Option.result_log_yn:
                case Option.dir_recursive_yn:
                {
                    ToggleSwitch ts = new ToggleSwitch() /*IsChecked = (bool)optionValue*/ }
                    {
                        ;
                        ts.Width = ConfigOptionSize.WIDTH_VALUE;
                        ts.HorizontalAlignment = HorizontalAlignment.Left;

                        ts.FontSize = 13;
                        ts.OffLabel = "False";
                        ts.OnLabel  = "True";
                        ts.Style    = (Style)App.Current.Resources["MahApps.Metro.Styles.ToggleSwitch.Win10"];

                        //if(panelDetailOption.RowDefinitions.Count > 0)
                        //	Grid.SetRow(ts, panelDetailOption.RowDefinitions.Count - 1);
                        //Grid.SetColumn(ts, 1);
                        ret = ts;

                        ts.DataContext = jprop.Parent;
                        Binding bd = new Binding(option.ToString());
                        bd.Mode      = BindingMode.TwoWay;
                        bd.Converter = new OnlyBooleanConverter();
                        ts.SetBinding(ToggleSwitch.IsCheckedProperty, bd);

                        ts.IsChecked = Convert.ToBoolean(jprop.Value);

                        ts.Checked += delegate
                        {
                            //((JValue)optionValue).Value = ts.IsChecked;
                            ConfigOptionManager.IsChanged = true;
                        };
                        ts.Unchecked += delegate
                        {
                            //((JValue)optionValue).Value = ts.IsChecked;
                            ConfigOptionManager.IsChanged = true;
                        };
                }
                break;

                case Option.dir_monitoring_term:
                case Option.dir_recursive_max_depth:
                {
                    NumericUpDown tb_integer = new NumericUpDown() /*Value = (System.Int64)optionValue*/ }
                    {
                        ;
                        tb_integer.Width = ConfigOptionSize.WIDTH_VALUE;
                        tb_integer.HorizontalAlignment = HorizontalAlignment.Left;

                        //if(panelDetailOption.RowDefinitions.Count > 0)
                        //	Grid.SetRow(tb_integer, panelDetailOption.RowDefinitions.Count - 1);
                        //Grid.SetColumn(tb_integer, 1);
                        ret = tb_integer;

                        tb_integer.DataContext = jprop.Parent;
                        Binding bd = new Binding(option.ToString());
                        bd.Mode      = BindingMode.TwoWay;
                        bd.Converter = new OnlyInt64Converter();
                        tb_integer.SetBinding(NumericUpDown.ValueProperty, bd);

                        tb_integer.Value = Convert.ToInt64(jprop.Value);

                        tb_integer.ValueChanged += delegate
                        {
                            //((JValue)optionValue).Value = (System.Int64)tb_integer.Value;
                            ConfigOptionManager.IsChanged = true;
                        };
                }
                break;

                default:
                    break;
                }

                if (jprop != null && jprop.Name[0] == ConfigOptionManager.StartDisableProperty &&
                    Root[jprop.Name.TrimStart(ConfigOptionManager.StartDisableProperty)] != null &&
                    Root[jprop.Name.TrimStart(ConfigOptionManager.StartDisableProperty)].Parent != null)
                {
                    Root[jprop.Name.TrimStart(ConfigOptionManager.StartDisableProperty)].Parent.Remove();
                }
            }
            catch (Exception e)
            {
                Log.PrintError(e.Message + " (\"" + option.ToString() + "\" : \"" + jprop + "\")", "UserControls.ConfigOption.File.comm_option.GetUIOptionValue");
            }

            if (ret != null)
            {
                ret.Width               = ConfigOptionSize.WIDTH_VALUE;
                ret.Margin              = new Thickness(10, 3, 10, 3);
                ret.VerticalAlignment   = VerticalAlignment.Center;
                ret.HorizontalAlignment = HorizontalAlignment.Left;
            }
            return(ret);
        }
예제 #8
0
        static FrameworkElement GetUIOptionValue(int opt, JObject root)
        {
            Options option = (Options)opt;

            JProperty        jprop = GetJProperty(option, root);
            FrameworkElement ret   = null;

            try
            {
                switch (option)
                {
                case Options.sam_type:
                {
                    Dictionary <string, int> dic = new Dictionary <string, int>()
                    {
                        { "var", 0 }
                        , { "fixed", 1 }
                    };
                    ComboBox cb = new ComboBox();
                    var      e  = dic.GetEnumerator();
                    while (e.MoveNext())
                    {
                        cb.Items.Add(e.Current.Key);
                    }

                    cb.DataContext = jprop.Parent;
                    Binding bd = new Binding(option.ToString());
                    bd.Mode      = BindingMode.TwoWay;
                    bd.Converter = new OnlyInt64Converter();
                    cb.SetBinding(ComboBox.SelectedIndexProperty, bd);

                    cb.SelectedIndex = Convert.ToInt32(jprop.Value);

                    cb.SelectionChanged += delegate {
                        //((JValue)optionValue).Value = dic[cb.SelectedItem.ToString()];
                        ConfigOptionManager.bChanged = true;
                        SamOptions.current.ChangeSecondGrid();
                    };
                    ret = cb;
                }
                break;

                case Options.trim:
                {
                    Dictionary <string, int> dic = new Dictionary <string, int>()
                    {
                        { "None", 0 }
                        , { "Right", 1 }
                        , { "Left", 2 }
                        , { "Both", 3 }
                    };
                    ComboBox cb = new ComboBox();
                    var      e  = dic.GetEnumerator();
                    while (e.MoveNext())
                    {
                        cb.Items.Add(e.Current.Key);
                    }

                    cb.DataContext = jprop.Parent;
                    Binding bd = new Binding(option.ToString());
                    bd.Mode      = BindingMode.TwoWay;
                    bd.Converter = new OnlyInt64Converter();
                    cb.SetBinding(ComboBox.SelectedIndexProperty, bd);

                    cb.SelectedIndex = Convert.ToInt32(jprop.Value);

                    cb.SelectionChanged += delegate {
                        //((JValue)optionValue).Value = dic[cb.SelectedItem.ToString()];
                        ConfigOptionManager.bChanged = true;
                    };
                    ret = cb;
                }
                break;

                case Options.sid:
                case Options.delimiter:
                case Options.input_filter:
                case Options.input_dir:
                case Options.input_ext:
                case Options.output_dir:
                case Options.output_ext:
                case Options.no_access_sentence:
                case Options.log_file:
                {
                    TextBox tb = new TextBox() /*Text = optionValue.ToString()*/ }
                    {
                        ;
                        tb.Width = JsonTreeViewItemSize.WIDTH_TEXTBOX;
                        tb.HorizontalAlignment = HorizontalAlignment.Left;
                        ret = tb;

                        tb.DataContext = jprop.Parent;
                        Binding bd = new Binding(option.ToString());
                        bd.Mode = BindingMode.TwoWay;
                        // TextBox.Text 의 UpdateSourceTrigger 의 기본속성은 LostFocus 이다.
                        bd.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
                        tb.SetBinding(TextBox.TextProperty, bd);

                        tb.Text = Convert.ToString(jprop.Value);

                        tb.TextChanged += delegate
                        {
                            //((JValue)optionValue).Value = tb.Text;
                            ConfigOptionManager.bChanged = true;
                        };
                }
                break;

                case Options.dir_monitoring_yn:
                case Options.file_reserver_yn:
                {
                    ToggleSwitch ts = new ToggleSwitch() /*IsChecked = (bool)optionValue*/ }
                    {
                        ;
                        ts.Width = JsonTreeViewItemSize.WIDTH_TEXTBOX;
                        ts.HorizontalAlignment = HorizontalAlignment.Left;

                        ts.FontSize = 13;
                        ts.OffLabel = "False";
                        ts.OnLabel  = "True";
                        ts.Style    = (Style)App.Current.Resources["MahApps.Metro.Styles.ToggleSwitch.Win10"];

                        //if(panelDetailOption.RowDefinitions.Count > 0)
                        //	Grid.SetRow(ts, panelDetailOption.RowDefinitions.Count - 1);
                        //Grid.SetColumn(ts, 1);
                        ret = ts;

                        ts.DataContext = jprop.Parent;
                        Binding bd = new Binding(option.ToString());
                        bd.Mode      = BindingMode.TwoWay;
                        bd.Converter = new OnlyBooleanConverter();
                        ts.SetBinding(ToggleSwitch.IsCheckedProperty, bd);

                        ts.IsChecked = Convert.ToBoolean(jprop.Value);

                        ts.Checked += delegate
                        {
                            //((JValue)optionValue).Value = ts.IsChecked;
                            ConfigOptionManager.bChanged = true;
                        };
                        ts.Unchecked += delegate
                        {
                            //((JValue)optionValue).Value = ts.IsChecked;
                            ConfigOptionManager.bChanged = true;
                        };
                }
                break;

                case Options.no_col:
                case Options.skip_header:
                case Options.record_len:
                case Options.dir_monitoring_term:
                {
                    NumericUpDown tb_integer = new NumericUpDown() /*Value = (System.Int64)optionValue*/ }
                    {
                        ;
                        tb_integer.Width = JsonTreeViewItemSize.WIDTH_TEXTBOX;
                        tb_integer.HorizontalAlignment = HorizontalAlignment.Left;

                        //if(panelDetailOption.RowDefinitions.Count > 0)
                        //	Grid.SetRow(tb_integer, panelDetailOption.RowDefinitions.Count - 1);
                        //Grid.SetColumn(tb_integer, 1);
                        ret = tb_integer;

                        tb_integer.DataContext = jprop.Parent;
                        Binding bd = new Binding(option.ToString());
                        bd.Mode      = BindingMode.TwoWay;
                        bd.Converter = new OnlyInt64Converter();
                        tb_integer.SetBinding(NumericUpDown.ValueProperty, bd);

                        tb_integer.Value = Convert.ToInt64(jprop.Value);

                        tb_integer.ValueChanged += delegate
                        {
                            //((JValue)optionValue).Value = (System.Int64)tb_integer.Value;
                            ConfigOptionManager.bChanged = true;
                        };
                }
                break;

                default:
                    break;
                }

                if (jprop != null && jprop.Name[0] == ConfigOptionManager.StartDisableProperty &&
                    Root[jprop.Name.TrimStart(ConfigOptionManager.StartDisableProperty)] != null &&
                    Root[jprop.Name.TrimStart(ConfigOptionManager.StartDisableProperty)].Parent != null)
                {
                    Root[jprop.Name.TrimStart(ConfigOptionManager.StartDisableProperty)].Parent.Remove();
                }
            }
            catch (Exception e)
            {
                Log.PrintError(e.Message + " (\"" + option.ToString() + "\" : \"" + jprop + "\")", "UserControls.ConfigOption.Sam.comm_option.GetUIOptionValue");
            }

            if (ret != null)
            {
                ret.Width               = 150;
                ret.Margin              = new Thickness(10, 3, 10, 3);
                ret.VerticalAlignment   = VerticalAlignment.Center;
                ret.HorizontalAlignment = HorizontalAlignment.Left;
            }
            return(ret);
        }
예제 #9
0
        private StackPanel BuildPeriodicalShootingPanel()
        {
            var indicator = new TextBlock()
            {
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Center,
                FontSize            = 16,
            };

            indicator.SetBinding(TextBlock.TextProperty, new Binding()
            {
                Source = ApplicationSettings.GetInstance(),
                Path   = new PropertyPath(nameof(ApplicationSettings.IntervalTimeDisplayString)),
                Mode   = BindingMode.OneWay,
            });

            var toggle = new ToggleSwitch()
            {
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Center,
                MinWidth            = 30,
                OffContent          = null,
                OnContent           = null,
            };

            toggle.SetBinding(ToggleSwitch.IsOnProperty, new Binding()
            {
                Source = ApplicationSettings.GetInstance(),
                Path   = new PropertyPath(nameof(ApplicationSettings.IsIntervalShootingEnabled)),
                Mode   = BindingMode.TwoWay,
            });
            toggle.SetBinding(Control.IsEnabledProperty, new Binding()
            {
                Source = DataSource,
                Path   = new PropertyPath(nameof(ControlPanelDataSource.IsPeriodicalShootingAvailable)),
                Mode   = BindingMode.OneWay,
            });

            var firstPanel = new StackPanel()
            {
                Orientation         = Windows.UI.Xaml.Controls.Orientation.Horizontal,
                Margin              = new Thickness(3, 2, 3, 2),
                HorizontalAlignment = HorizontalAlignment.Stretch,
            };

            firstPanel.Children.Add(toggle);
            firstPanel.Children.Add(indicator);

            var slider = BuildSlider(2, 60);

            slider.Value         = ApplicationSettings.GetInstance().IntervalTime;
            slider.ValueChanged += (sender, e) =>
            {
                ApplicationSettings.GetInstance().IntervalTime = (int)(sender as Slider).Value;
                DebugUtil.Log(() => "Interval updated: " + (int)(sender as Slider).Value);
            };
            slider.SetBinding(Control.IsEnabledProperty, new Binding()
            {
                Source = DataSource,
                Path   = new PropertyPath(nameof(ControlPanelDataSource.IsPeriodicalShootingAvailable)),
                Mode   = BindingMode.OneWay,
            });
            slider.SetBinding(UIElement.VisibilityProperty, new Binding()
            {
                Source    = toggle,
                Path      = new PropertyPath(nameof(ToggleSwitch.IsOn)),
                Mode      = BindingMode.OneWay,
                Converter = new BoolToVisibilityConverter(),
            });

            var parent = BuildBasicPanel(SystemUtil.GetStringResource("IntervalSetting"));

            parent.Children.Add(firstPanel);
            parent.Children.Add(slider);

            return(parent);
        }
        public Window_AddDataGridInConfig(string[] detail, object[] InitValue)
        {
            InitializeComponent();

            Value            = InitValue;
            this.DataContext = this;
            int i;

            this.Height = 100 + InitValue.Length * HEIGHT_ROW;
            for (i = 0; i < InitValue.Length; i++)
            {
                TextBlock tblock = new TextBlock()
                {
                    Text                = detail[i],
                    Margin              = new Thickness(0, i * HEIGHT_ROW + 5, 5, 5),
                    VerticalAlignment   = VerticalAlignment.Top,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    TextAlignment       = TextAlignment.Center,
                    Height              = HEIGHT_ROW
                };
                grid.Children.Add(tblock);
                Grid.SetColumn(tblock, 0);

                //Console.WriteLine("InitValue[i] = " + InitValue[i].GetType());
                if (InitValue[i] == null)
                {
                    continue;
                }

                if (InitValue[i].GetType() == typeof(bool) ||
                    (InitValue[i] as JValue != null && ((JValue)InitValue[i]).Type == JTokenType.Boolean))
                {
                    ToggleSwitch ts = new ToggleSwitch()
                    {
                        IsChecked           = Convert.ToBoolean(InitValue[i]),
                        Margin              = new Thickness(0, i * HEIGHT_ROW + 5, 5, 5),
                        VerticalAlignment   = VerticalAlignment.Top,
                        HorizontalAlignment = HorizontalAlignment.Stretch,
                        Height              = HEIGHT_ROW,
                        FontSize            = 13,
                        OffLabel            = "False",
                        OnLabel             = "True",
                        Style = (Style)App.Current.Resources["MahApps.Metro.Styles.ToggleSwitch.Win10"]
                    };
                    Binding bd = new Binding("Value[" + i + "]");
                    bd.Converter = new OnlyBooleanConverter();
                    ts.SetBinding(ToggleSwitch.IsCheckedProperty, bd);

                    grid.Children.Add(ts);
                    Grid.SetColumn(ts, 1);
                }
                else if (InitValue[i].GetType() == typeof(Int64) ||
                         (InitValue[i] as JValue != null && ((JValue)InitValue[i]).Type == JTokenType.Integer))
                {
                    NumericUpDown nud = new NumericUpDown()
                    {
                        Value               = Convert.ToInt64(InitValue[i]),
                        Margin              = new Thickness(0, i * HEIGHT_ROW + 5, 5, 5),
                        VerticalAlignment   = VerticalAlignment.Top,
                        HorizontalAlignment = HorizontalAlignment.Stretch,
                        Height              = HEIGHT_ROW
                    };
                    Binding bd = new Binding("Value[" + i + "]");
                    bd.Converter = new OnlyInt64Converter();
                    nud.SetBinding(NumericUpDown.ValueProperty, bd);

                    grid.Children.Add(nud);
                    Grid.SetColumn(nud, 1);
                }
                else if (InitValue[i].GetType() == typeof(string) ||
                         (InitValue[i] as JValue != null && ((JValue)InitValue[i]).Type == JTokenType.String))
                {
                    TextBox tb = new TextBox()
                    {
                        Text                = Convert.ToString(InitValue[i]),
                        Margin              = new Thickness(0, i * HEIGHT_ROW + 5, 5, 5),
                        VerticalAlignment   = VerticalAlignment.Top,
                        HorizontalAlignment = HorizontalAlignment.Stretch,
                        Height              = HEIGHT_ROW
                    };
                    Binding bd = new Binding("Value[" + i + "]");
                    bd.Converter = new OnlyStringConverter();
                    tb.SetBinding(TextBox.TextProperty, bd);

                    grid.Children.Add(tb);
                    Grid.SetColumn(tb, 1);
                }
            }
        }