Exemple #1
0
        private void RenderListBox(XListBox listBox)
        {
            var result = new FrameView()
            {
                Title = listBox.Title,
                X     = Pos.Left(this) + listBox.Left + _left,
            };

            var list = new ListView
            {
                Width  = Dim.Fill(),
                Height = Dim.Fill(),
            };

            list.SelectedItemChanged += List_SelectedItemChanged;

            if (Binder.IsBindable(listBox.ItemSourceProperty))
            {
                list.SetSource(_binder.GetList(listBox.ItemSourceProperty));
            }
            if (Binder.IsBindable(listBox.SelectedIndex))
            {
                list.SelectedItem = Convert.ToInt32(_binder.GetBindedText(listBox.SelectedIndex));
                _binder.Register(listBox, list, typeof(int));
            }

            result.Add(list);
            result.Height = Dim.Fill();
            UiPage.SetWidth(result, listBox);

            Add(result);
            _left += Pos.Right(result);
        }
Exemple #2
0
        private void RenderTextBox(XTextBox textBox)
        {
            var result = new FrameView()
            {
                X = Pos.Left(this) + textBox.Left + _left,
            };

            var text = new TextView
            {
                Width    = Dim.Fill(),
                Height   = Dim.Fill(),
                ReadOnly = textBox.IsReadonly
            };

            if (Binder.IsBindable(textBox.Text))
            {
                text.Text = _binder.GetBindedText(textBox.Text);
                _binder.Register(textBox, text, typeof(string));
            }
            else
            {
                text.Text = textBox.Text;
            }

            result.Add(text);
            result.Height = Dim.Fill();
            UiPage.SetWidth(result, textBox);

            Add(result);
            _left += Pos.Right(result);
        }