Beispiel #1
17
		public TreeViewSection()
		{
			var layout = new DynamicLayout();
			
			layout.BeginHorizontal();
			layout.Add(new Label());
			layout.BeginVertical();
			layout.BeginHorizontal();
			layout.Add(null);
			layout.Add(allowExpanding = new CheckBox{ Text = "Allow Expanding", Checked = true });
			layout.Add(allowCollapsing = new CheckBox{ Text = "Allow Collapsing", Checked = true });
			layout.Add(RefreshButton());
			layout.Add(null);
			layout.EndHorizontal();
			layout.EndVertical();
			layout.EndHorizontal();

			treeView = ImagesAndMenu();

			layout.AddRow(new Label{ Text = "Simple" }, Default());
			layout.BeginHorizontal();
			layout.Add(new Panel());
			layout.BeginVertical();
			layout.AddSeparateRow(InsertButton(), AddChildButton(), RemoveButton(), ExpandButton(), CollapseButton(), null);
			layout.AddSeparateRow(LabelEditCheck(), EnabledCheck(), null);
			layout.EndVertical();
			layout.EndHorizontal();
			layout.AddRow(new Label{ Text = "With Images\n&& Context Menu" }, treeView);
			layout.AddRow(new Panel(), HoverNodeLabel());

			layout.Add(null, false, true);

			Content = layout;
		}
Beispiel #2
1
		public TreeGridViewSection()
		{
			var layout = new DynamicLayout();
		
			layout.BeginHorizontal();
			layout.Add(new Label());
			layout.BeginVertical();
			layout.BeginHorizontal();
			layout.Add(null);
			layout.Add(allowExpanding = new CheckBox{ Text = "Allow Expanding", Checked = true });
			layout.Add(allowCollapsing = new CheckBox{ Text = "Allow Collapsing", Checked = true });
			layout.Add(null);
			layout.EndHorizontal();
			layout.EndVertical();
			layout.EndHorizontal();
			
			layout.AddRow(new Label{ Text = "Simple" }, Default());
			
			layout.AddRow(new Label{ Text = "With Images\n&& Context Menu" }, ImagesAndMenu());
			layout.AddRow(new Label{ Text = "Disabled" }, Disabled());
			
			layout.Add(null, false, true);

			Content = layout;
		}
Beispiel #3
0
		public BitmapSection()
		{
			var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5), Padding = new Padding(10) };

			layout.AddRow(
				"Load from Stream", LoadFromStream(), 
				"Custom 24-bit", CreateCustom24(),
				null
			);

			layout.AddRow(
				"Custom 32-bit", CreateCustom32(),
				"Custom 32-bit alpha", CreateCustom32Alpha(),
				null
			);

			layout.AddRow(
				"Clone", Cloning(),
				"Clone rectangle", TableLayout.AutoSized(CloneRectangle(), centered: true),
				null);

			layout.AddRow(
				"Draw to a rect", TableLayout.AutoSized(DrawImageToRect(), centered: true)
			);

			layout.Add(null);

			Content = layout;
		}
Beispiel #4
0
		public ServerDialog (Server server, bool isNew, bool allowConnect)
		{
			this.isNew = isNew;
			this.allowConnect = allowConnect && !isNew;
			this.Server = server;
			this.Title = "Add Server";
			this.MinimumSize = new Size (300, 0);
			this.DataContext = server;
			
			var layout = new DynamicLayout (this);
			
			layout.BeginVertical ();
			
			layout.AddRow (new Label { Text = "Server Name"}, ServerName ());
			
			// generate server-specific edit controls
			server.GenerateEditControls (layout, isNew);
			
			layout.AddRow (null, AutoConnectButton());
			
			layout.EndBeginVertical ();

			layout.AddRow (Connect (), Disconnect (), null, cancelButton = this.CancelButton (), this.OkButton ("Save", () => SaveData()));
			
			layout.EndVertical ();
			
			SetVisibility ();
		}
Beispiel #5
0
		public PixelOffsetSection()
		{
			var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5), Padding = new Padding(10) };

			var drawable = new Drawable { Size = canvasSize };
			drawable.Paint += (sender, pe) =>
			{
				pe.Graphics.FillRectangle(Brushes.Black, pe.ClipRectangle);
				pe.Graphics.PixelOffsetMode = PixelOffsetMode.None;
				Draw(pe.Graphics);
			};
			layout.AddRow(new Label { Text = "None (Default)" }, drawable);

			drawable = new Drawable { Size = canvasSize };
			drawable.Paint += (sender, pe) =>
			{
				pe.Graphics.FillRectangle(Brushes.Black, pe.ClipRectangle);
				pe.Graphics.PixelOffsetMode = PixelOffsetMode.Half;
				Draw(pe.Graphics);
			};
			layout.AddRow(new Label { Text = "Half" }, drawable);
			layout.Add(null);

			Content = layout;
		}
Beispiel #6
0
		public TransformSection()
		{
			image = TestIcons.TestIcon;
			font = Fonts.Sans(10);

			var layout = new DynamicLayout();

			var drawable = new Drawable { Size = canvasSize };
			drawable.Paint += (sender, pe) => {
				pe.Graphics.FillRectangle(Brushes.Black, pe.ClipRectangle);
				MatrixTests(pe.Graphics);
			};
			layout.AddRow(new Label { Text = "Matrix" }, drawable);

			drawable = new Drawable { Size = canvasSize };
			drawable.Paint += (sender, pe) => {
				pe.Graphics.FillRectangle(Brushes.Black, pe.ClipRectangle);
				DirectTests(pe.Graphics);
			};
			layout.AddRow(new Label { Text = "Direct" }, drawable);
			layout.Add(null);

			var m = Matrix.Create();
			m.Scale(100, 100);
			var m2 = m.Clone();
			m2.Translate(10, 10);

			if (m == m2)
				throw new Exception("Grr!");

			Content = layout;
		}
Beispiel #7
0
		Control TestProperties()
		{
			var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5) };
			DateTimePicker min, max, current, setValue;
			Button setButton;

			layout.AddRow("Min Value", min = new DateTimePicker());
			layout.AddRow("Max Value", max = new DateTimePicker());
			layout.BeginHorizontal();
			layout.Add("Set to value");
			layout.BeginVertical(Padding.Empty);
			layout.BeginHorizontal();
			layout.AddAutoSized(setValue = new DateTimePicker());
			layout.Add(setButton = new Button { Text = "Set" });
			layout.EndHorizontal();
			layout.EndVertical();
			layout.EndHorizontal();
			layout.AddRow("Value", current = new DateTimePicker());

			min.ValueChanged += (sender, e) => current.MinDate = min.Value ?? DateTime.MinValue;
			max.ValueChanged += (sender, e) => current.MaxDate = max.Value ?? DateTime.MaxValue;
			setButton.Click += (sender, e) => current.Value = setValue.Value;
			LogEvents(current);

			return layout;
		}
Beispiel #8
0
		public BitmapSection()
		{
			var layout = new DynamicLayout();

			layout.AddRow(new Label { Text = "Load from Stream" }, LoadFromStream());

			layout.AddRow(
				new Label { Text = "Custom 32-bit" }, CreateCustom32(),
				new Label { Text = "Custom 32-bit alpha" }, CreateCustom32Alpha(),
				null
			);

			layout.AddRow(
				new Label { Text = "Clone" }, Cloning(),
				new Label { Text = "Clone rectangle" }, TableLayout.AutoSized(CloningRectangle(), centered: true),
				null);

			layout.AddRow(
				new Label { Text = "Clone using tiles" }, TableLayout.AutoSized(CloneTiles(), centered: true),
				new Label { Text = "Draw to a rect" }, TableLayout.AutoSized(DrawImageToRect(), centered: true),
				null);

			layout.Add(null);

			Content = layout;
		}
Beispiel #9
0
        void Init()
        {
	        _tbxShellData = new TextArea {Size = new Size(-1, 200)};
            _tbxMsg = new TextBox();
	        _btnShowMsgInStatus = new Button {Text = "Show Msg In Status", Width = 150};
            _btnShowMsgInStatus.Click+=btn_showMsgInStatus_Click;
			_btnShowMessageBox = new Button { Text = "Show Msg In Message", Width = 150 };
            _btnShowMessageBox.Click+=btn_showMessageBox_Click;
			_btnCreateNewTabPage = new Button { Text = "Create New TabPage", Width = 150 };
            _btnCreateNewTabPage.Click+=btn_createNewTabPage_Click;

			// Test
	        var btnTest = new Button {Text = "Test", Width = 150};
			btnTest.Click += btnTest_Click;

	        var layout = new DynamicLayout {Padding = new Padding(10, 10), Size = new Size(10, 10)};
            layout.AddRow(new Label() { Text = "ShellData"});
			layout.AddRow(_tbxShellData);
			layout.AddSeparateRow(new Label() { Text = "Msg", VerticalAlign = VerticalAlign.Middle }, _tbxMsg, null);
	        layout.AddAutoSized(_btnShowMsgInStatus);
	        layout.AddAutoSized(_btnShowMessageBox);
	        layout.AddAutoSized(_btnCreateNewTabPage);
			layout.AddAutoSized(btnTest);
			layout.Add(null);

            this.Content = layout;
        }
Beispiel #10
0
		public GridViewSection()
		{
			var layout = new DynamicLayout();

			layout.AddRow(new Label { Text = "Default" }, Default());
			layout.AddRow(new Label { Text = "No Header,\nNon-Editable" }, NoHeader());
#if DESKTOP
			layout.BeginHorizontal();
			layout.Add(new Label { Text = "Context Menu\n&& Multi-Select\n&& Filter" });
			layout.BeginVertical();
			layout.Add(filterText = new SearchBox { PlaceholderText = "Filter" });
			var withContextMenuAndFilter = WithContextMenuAndFilter();
			layout.Add(withContextMenuAndFilter);
			layout.EndVertical();
			layout.EndHorizontal();

			var selectionGridView = Default(addItems: false);
			layout.AddRow(new Label { Text = "Selected Items" }, selectionGridView);

			// hook up selection of main grid to the selection grid
			withContextMenuAndFilter.SelectionChanged += (s, e) =>
			{
				var items = new DataStoreCollection();
				items.AddRange(withContextMenuAndFilter.SelectedItems);
				selectionGridView.DataStore = items;
			};
#endif

			Content = layout;
		}
		Control TestProperties()
		{
			var layout = new DynamicLayout();
			DateTimePicker min, max, current, setValue;
			Button setButton;

			layout.AddRow(new Label { Text = "Min Value" }, min = new DateTimePicker());
			layout.AddRow(new Label { Text = "Max Value" }, max = new DateTimePicker());
			layout.BeginHorizontal();
			layout.Add(new Label { Text = "Set to value" });
			layout.BeginVertical();
			layout.BeginHorizontal();
			layout.AddAutoSized(setValue = new DateTimePicker());
			layout.Add(setButton = new Button { Text = "Set" });
			layout.EndHorizontal();
			layout.EndVertical();
			layout.EndHorizontal();
			layout.AddRow(new Label { Text = "Value" }, current = new DateTimePicker());

			min.ValueChanged += (sender, e) => current.MinDate = min.Value ?? DateTime.MinValue;
			max.ValueChanged += (sender, e) => current.MaxDate = max.Value ?? DateTime.MaxValue;
			setButton.Click += (sender, e) => current.Value = setValue.Value;
			LogEvents(current);

			return layout;
		}
Beispiel #12
0
        public GridViewSection()
        {
            var layout = new DynamicLayout (this);

            layout.AddRow (new Label { Text = "Default" }, Default ());
            layout.AddRow (new Label { Text = "No Header,\nNon-Editable" }, NoHeader ());
            layout.AddRow (new Label { Text = "Context Menu\n& Multi-Select" }, WithContextMenu ());
        }
Beispiel #13
0
		public FileDialogSection ()
		{
			var layout = new DynamicLayout (this, new Size (20, 20));

			layout.AddRow (null, OpenFile (), OpenFileWithFilters (), null);
			layout.AddRow (null, SaveFile (), SaveFileWithFilters (), null);

			layout.Add (null);
		}
		Control PrintDialogOptions()
		{
			var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5), Padding = new Padding(10) };

			layout.AddRow(null, AllowPageRange());
			layout.AddRow(null, AllowSelection());

			return new GroupBox { Text = "Print Dialog Options", Content = layout };
		}
Beispiel #15
0
		public SelectFolderSection ()
		{
			var layout = new DynamicLayout (this, new Size (20, 20));

			layout.AddRow (null, SelectFolder (), null);
			layout.AddRow (null, SelectFolderWithStartupPath (), null);

			layout.Add (null);
		}
		void Init()
		{
			// radioButton_noProxy
			_radioButtonNoProxy = new RadioButton() { Text = AltStrRes.NotUseProxy };
			_radioButtonNoProxy.CheckedChanged += delegate
			{
				if (_radioButtonNoProxy.Checked)
				{
					_groupBoxSetting.Enabled = false;
				}
			};

			// radioButton_ieProxy
			_radioButtonIeProxy = new RadioButton(_radioButtonNoProxy) { Text = AltStrRes.UseSystemProxySetting };
			_radioButtonIeProxy.CheckedChanged += delegate
			{
				if (_radioButtonIeProxy.Checked)
				{
					_groupBoxSetting.Enabled = false;
				}
			};

			// radioButton_customProxy
			_radioButtonCustomProxy = new RadioButton(_radioButtonNoProxy) { Text = AltStrRes.UseCustomProxySetting };
			_radioButtonCustomProxy.CheckedChanged += delegate
			{
				if (_radioButtonCustomProxy.Checked)
				{
					_groupBoxSetting.Enabled = true;
				}
			};

			// textBox
			_textBoxProxyAddr = new TextBox();
			_textBoxProxyPort = new TextBox();
			_textBoxProxyUser = new TextBox();
			_textBoxProxyPasswd = new TextBox();
			_textBoxProxyDomain = new TextBox();

			var proxysetting = new DynamicLayout { Padding = new Padding(20, 10), Spacing = new Size(5, 5) };
			proxysetting.AddRow(new Label { Text = "Server: ", VerticalAlign = VerticalAlign.Middle}, TableLayout.AutoSized(_textBoxProxyAddr));
			proxysetting.AddRow(new Label { Text = "Port: ", VerticalAlign = VerticalAlign.Middle }, TableLayout.AutoSized(_textBoxProxyPort));
			proxysetting.AddRow(new Label { Text = "User: "******"Passwd: ", VerticalAlign = VerticalAlign.Middle }, TableLayout.AutoSized(_textBoxProxyPasswd));
			proxysetting.AddRow(new Label { Text = "Domain: ", VerticalAlign = VerticalAlign.Middle }, TableLayout.AutoSized(_textBoxProxyDomain));

			_groupBoxSetting = new GroupBox {Text = AltStrRes.Setting, Content = proxysetting};

			var layout = new DynamicLayout { Padding = new Padding(20, 20), Spacing = new Size(10, 10) };
			layout.AddRow(_radioButtonNoProxy);
			layout.AddRow(_radioButtonIeProxy);
			layout.AddRow(_radioButtonCustomProxy);
			layout.AddRow(_groupBoxSetting);
			layout.AddRow(null);

			this.Content = layout;
		}
		Control PrintDialogOptions()
		{
			var layout = new DynamicLayout();

			layout.AddRow(null, AllowPageRange());
			layout.AddRow(null, AllowSelection());

			return new GroupBox { Text = "Print Dialog Options", Content = layout };
		}
Beispiel #18
0
		public ColorDialogSection ()
		{
			var layout = new DynamicLayout (this, new Size (20, 20));

			layout.AddRow (null, PickColor (), null);
			layout.AddRow (null, PickColorWithStartingColor (), null);

			layout.Add (null);
		}
Beispiel #19
0
		public CustomDialogSection ()
		{
			var layout = new DynamicLayout (this, new Size (20, 20));

			layout.AddRow (null, Standard (), null);
			layout.AddRow (null, Resizable (), null);
			layout.AddRow (null, KitchenSink (), null);

			layout.Add (null);
		}
Beispiel #20
0
		Control LoginSection ()
		{
			var layout = new DynamicLayout (loginSection = new GroupBox{ Text = "Login"});
			
			layout.Add (null);
			layout.AddRow (new Label { Text = "UserName" }, EditUserName ());
			layout.AddRow (new Label { Text = "Password" }, EditPassword ());
			layout.Add (null);

			return layout.Container;
		}
Beispiel #21
0
		public GroupBoxSection ()
		{
			var layout = new DynamicLayout (this);
			
			
			layout.AddRow (new Label{ Text = "Default"}, Default ());
			
			layout.AddRow (new Label { Text = "With Header" }, Header ());
			
			layout.Add (null, null, true);
		}
Beispiel #22
0
		public FileDialogSection()
		{
			var layout = new DynamicLayout { Spacing = new Size(20, 20) };

			layout.AddRow(null, OpenFile(), OpenFileWithFilters(), null);
			layout.AddRow(null, SaveFile(), SaveFileWithFilters(), null);

			layout.Add(null);

			Content = layout;
		}
Beispiel #23
0
        public AllControlsBase()
        {
            var layout = new DynamicLayout (this);

            layout.AddRow (null, LabelControl (), ButtonControl (), null);
            layout.AddRow (null, TextBoxControl (), TextAreaControl (), null);
            layout.AddRow (null, CheckBoxControl (), RadioButtonControl (), null);
            layout.AddRow (null, DateTimeControl (), NumericUpDownControl (), null);
            layout.AddRow (null, ComboBoxControl (), DrawableControl (), null);
            layout.Add (null);
        }
		public SelectFolderSection()
		{
			var layout = new DynamicLayout { Spacing = new Size(20, 20) };

			layout.AddRow(null, SelectFolder(), null);
			layout.AddRow(null, SelectFolderWithStartupPath(), null);

			layout.Add(null);

			Content = layout;
		}
Beispiel #25
0
        public TreeViewSection()
        {
            var layout = new DynamicLayout (this);

            layout.AddRow (new Label{ Text = "Simple" }, Default ());

            layout.AddRow (new Label{ Text = "With Images\n& Context Menu" }, ImagesAndMenu ());
            layout.AddRow (new Label{ Text = "Disabled" }, Disabled ());

            layout.Add (null, false, true);
        }
Beispiel #26
0
		public ColorDialogSection()
		{
			var layout = new DynamicLayout { Spacing = new Size(20, 20), DefaultSpacing = new Size(5, 5), Padding = new Padding(10) };

			layout.AddRow(null, PickColor(), null);
			layout.AddRow(null, PickColorWithStartingColor(), null);

			layout.Add(null);

			Content = layout;
		}
Beispiel #27
0
		public SpinnerSection()
		{
			var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5), Padding = new Padding(10) };

			layout.AddRow(new Label { Text = "Default" }, Default());
			layout.AddRow(new Label { Text = "Larger" }, Default(new Size(100, 100)));

			layout.Add(null, null, true);

			Content = layout;
		}
Beispiel #28
0
		public DateTimePickerSection ()
		{
			var layout = new DynamicLayout (this);
			
			layout.AddRow (new Label{ Text = "Default" }, Default (), new Label { Text = "Default with Value" }, DefaultWithValue (), null);
			layout.AddRow (new Label{ Text = "Date" }, DateControl (), new Label { Text = "Date with Value" }, DateControlWithValue ());
			layout.AddRow (new Label{ Text = "Time" }, TimeControl (), new Label { Text = "Time with Value" }, TimeControlWithValue ());
			layout.AddRow (new Label{ Text = "Date/Time" }, DateTimeControl (), new Label { Text = "Date/Time with Value" }, DateTimeControlWithValue ());
			
			// growing space at end is blank!
			layout.Add (null);
		}
Beispiel #29
0
        void Init()
        {
            //_textAreaWelcome
	        _textAreaWelcome = new TextArea() {Size = new Size(418, 277), Text = AltStrRes.Disclaimer};
	        _textAreaWelcome.Wrap = true;
	        _textAreaWelcome.Enabled = false;

            //_checkBoxNoDisplay
			_checkBoxNoDisplay = new CheckBox() { Text = AltStrRes.DontDisplayAgain};

            //_buttonNo
			_buttonNo = new Button() { Text = AltStrRes.No};
            _buttonNo.Click += delegate
            {
                if (_checkBoxNoDisplay.Checked == true)
                {
                    _setting.IsShowDisclaimer = false;

                    //保存Setting到xml
					InitWorker.SaveSettingToXml(AppEnvironment.AppPath, _setting);
                    //重新初始化GlobalSetting
					InitWorker.InitGlobalSetting(AppEnvironment.AppPath);
                }
				//Application.Instance.Quit();
				Environment.Exit(0);
            };

            //_buttonYes
	        _buttonYes = new Button() {Text = AltStrRes.Yes};
            _buttonYes.Click += delegate
            {
                if (_checkBoxNoDisplay.Checked == true)
                {
                    _setting.IsShowDisclaimer = false;
                    //保存Setting到xml
					InitWorker.SaveSettingToXml(AppEnvironment.AppPath, _setting);
                    //重新初始化GlobalSetting
					InitWorker.InitGlobalSetting(AppEnvironment.AppPath);
                }
                Close();
            };

            var layout = new DynamicLayout();
            layout.AddRow(_textAreaWelcome);
            layout.AddSeparateRow(_checkBoxNoDisplay,null, _buttonNo, _buttonYes);
            layout.AddRow(null);

            Content = layout;
            Size = new Size(460,370);
			Icon = Icons.AltmanIcon;
			ShowInTaskbar = true;
            Title = AltStrRes.Welcome;
        }
Beispiel #30
0
		public ClearSection()
		{
			var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5), Padding = new Padding(10) };
			layout.AddSeparateRow(null, UseClearColorControl(), UseGraphicsPathClipControl(), null);
			layout.BeginVertical();
			layout.AddRow(new Label { Text = "Drawable" }, ClearGraphicsTest(), null);
			layout.AddRow(new Label { Text = "Bitmap (with yellow background)" }, ClearBitmapTest(), null);
			layout.EndVertical();
			layout.Add(null);

			Content = layout;
		}
Beispiel #31
0
        public Dialog_Legend(LegendParameter parameter, Action <LegendParameter> previewAction = default)
        {
            this.Title = $"Legend Parameters - {DialogHelper.PluginName}";
            this.Width = 400;
            this.Icon  = DialogHelper.HoneybeeIcon;

            _vm = new LegendViewModel(parameter, this);

            var title = new TextBox();
            var x     = new Eto.Forms.NumericStepper()
            {
                MinValue = 0
            };
            var y = new Eto.Forms.NumericStepper()
            {
                MinValue = 0
            };
            var w = new Eto.Forms.NumericStepper()
            {
                MinValue = 1
            };
            var h = new Eto.Forms.NumericStepper()
            {
                MinValue = 1
            };
            var fontH = new Eto.Forms.NumericStepper()
            {
                MinValue = 1
            };
            var fontColor     = new Button();
            var decimalPlaces = new Eto.Forms.NumericStepper()
            {
                DecimalPlaces = 0, MinValue = 0
            };


            title.TextBinding.Bind(_vm, _ => _.Title);
            x.ValueBinding.Bind(_vm, _ => _.X);
            y.ValueBinding.Bind(_vm, _ => _.Y);
            w.ValueBinding.Bind(_vm, _ => _.W);
            h.ValueBinding.Bind(_vm, _ => _.H);
            fontH.ValueBinding.Bind(_vm, _ => _.FontHeight);
            fontColor.Bind(_ => _.BackgroundColor, _vm, _ => _.FontColor);
            fontColor.Command = _vm.FontColorCommand;
            decimalPlaces.ValueBinding.Bind(_vm, _ => _.DecimalPlaces);

            var minNum = new Eto.Forms.NumericStepper()
            {
                MaximumDecimalPlaces = 5
            };
            var maxNum = new Eto.Forms.NumericStepper()
            {
                MaximumDecimalPlaces = 5
            };
            var numSeg = new Eto.Forms.NumericStepper()
            {
                DecimalPlaces = 0, MinValue = 1
            };
            var continuous = new CheckBox();
            var horizontal = new CheckBox();

            minNum.ValueBinding.Bind(_vm, _ => _.Min);
            maxNum.ValueBinding.Bind(_vm, _ => _.Max);
            numSeg.ValueBinding.Bind(_vm, _ => _.NumSeg);
            continuous.CheckedBinding.Bind(_vm, _ => _.Continuous);
            horizontal.CheckedBinding.Bind(_vm, _ => _.IsHorizontal);
            minNum.Bind(_ => _.Enabled, _vm, _ => _.IsNumberValues);
            maxNum.Bind(_ => _.Enabled, _vm, _ => _.IsNumberValues);
            numSeg.Bind(_ => _.Enabled, _vm, _ => _.IsNumberValues);
            continuous.Bind(_ => _.Enabled, _vm, _ => _.IsNumberValues);


            var colorPanel = GenColorControl();
            var tb         = new TabControl();

            tb.Pages.Add(new TabPage(colorPanel)
            {
                Text = "Colors"
            });

            var general = new DynamicLayout();

            general.Height         = 280;
            general.DefaultSpacing = new Eto.Drawing.Size(5, 5);
            general.DefaultPadding = new Eto.Drawing.Padding(5);
            general.AddRow("Font height:", fontH);
            general.AddRow("Font color:", fontColor);
            general.AddRow("Location X:", x);
            general.AddRow("Location Y:", y);
            general.AddRow("Width:", w);
            general.AddRow("Height:", h);
            general.AddRow("Decimal places", decimalPlaces);
            general.AddRow(null, null);
            tb.Pages.Add(new TabPage(general)
            {
                Text = "Settings"
            });

            var OkBtn = new Eto.Forms.Button()
            {
                Text = "OK"
            };

            OkBtn.Click += (s, e) => {
                if (_vm.Validate())
                {
                    var lg = _vm.GetLegend();
                    this.Close(lg);
                }
            };
            this.AbortButton = new Eto.Forms.Button()
            {
                Text = "Cancel"
            };
            this.AbortButton.Click += (s, e) => { this.Close(); };

            var preview = new Button()
            {
                Text = "Preview", Visible = previewAction != default
            };

            preview.Click += (s, e) =>
            {
                if (_vm.Validate())
                {
                    var lg = _vm.GetLegend();
                    previewAction?.Invoke(lg);
                }
            };

            var layout = new Eto.Forms.DynamicLayout();

            layout.DefaultSpacing = new Eto.Drawing.Size(5, 2);
            layout.DefaultPadding = new Eto.Drawing.Padding(4);
            layout.AddSeparateRow("Legend title:", title);
            layout.AddSeparateRow("Maximum:", maxNum);
            layout.AddSeparateRow("Minimum:", minNum);
            layout.AddSeparateRow("Number of segment:", numSeg);
            layout.AddSeparateRow("Continuous colors:", continuous);
            layout.AddSeparateRow("Horizontal:", horizontal);

            layout.AddSeparateRow(tb);

            //layout.AddSeparateRow("Font height:", fontH, null, "Font color:", fontColor);
            //layout.AddSeparateRow("X:", x, "Y:", y, "W", w, "H", h);
            layout.AddSeparateRow(null, OkBtn, this.AbortButton, null, preview);
            layout.AddRow(null);
            this.Content = layout;
        }