public GridColumnHandler() { Control = new Gtk.TreeViewColumn(); AutoSize = true; Resizable = true; DataCell = new TextBoxCell(); }
private void SetupGrid() { MainGrid.DataStore = ViewModel.Lines; MainGrid.ShowHeader = false; MainGrid.CellSpacing(-1); MainGrid.SelectedItemBinding.BindDataContext <ILogViewerGridViewModel>(m => m.SelectedLine); MainGrid.GridLines = GridLines.None; MainGrid.Border = BorderType.None; MainGrid.AllowMultipleSelection = true; MainGrid.SelectionChanged += MainGrid_SelectionChanged; MainGrid.CellFormatting += MainGrid_CellFormatting; var cell = new TextBoxCell(nameof(ILogViewerGridViewModel.Lines)) { Binding = Binding.Property <LogModel, string>(m => m.Line), }; var column = new GridColumn() { DataCell = cell, Width = 2000 /*, AutoSize = false*/ }; MainGrid.Columns.Add(column); }
protected override void Initialize() { base.Initialize(); DataCell = new TextBoxCell(); Editable = false; Sortable = false; }
protected override void Initialize() { base.Initialize(); DataCell = new TextBoxCell(Widget.Generator); Editable = false; AutoSize = true; Resizable = true; }
public GridColumnHandler() { Control = new swf.DataGridViewColumn(); DataCell = new TextBoxCell(); Editable = false; AutoSize = true; Resizable = true; }
public GridColumnHandler() { Control = new EtoDataGridViewColumn { Handler = this }; DataCell = new TextBoxCell(); Editable = false; Resizable = true; }
protected override void Initialize() { Control.ResizingMask = NSTableColumnResizing.None; Sortable = false; HeaderText = string.Empty; Editable = false; AutoSize = true; DataCell = new TextBoxCell(); base.Initialize(); }
public GridColumnHandler() { Control = new NSTableColumn(); Control.ResizingMask = NSTableColumnResizing.None; Sortable = false; HeaderText = string.Empty; Editable = false; AutoSize = true; DataCell = new TextBoxCell(); }
public void AddColumn(string caption, int width, bool autoSize = false) { var cell = new TextBoxCell(Columns.Count); GridColumn column = new GridColumn(); column.HeaderText = caption; column.DataCell = cell; column.AutoSize = autoSize; column.Width = width; Columns.Add(column); }
private GridView GenColorPanel() { var gridView = new GridView(); gridView.Height = 280; gridView.Width = 300; gridView.ShowHeader = false; gridView.Bind(_ => _.DataStore, _vm, v => v.GridViewDataCollection); gridView.SelectedItemsChanged += (s, e) => { _vm.SelectedItem = gridView.SelectedItem as ColorDataItem; }; gridView.Bind(_ => _.SelectedRow, _vm, v => v.SelectedRow); var cTB = new TextBoxCell(); gridView.Columns.Add(new GridColumn { DataCell = cTB, ID = "Color" }); var nameTB = new TextBoxCell { Binding = Binding.Delegate <ColorDataItem, string>(_ => _.Text) }; gridView.Columns.Add(new GridColumn { DataCell = nameTB }); gridView.CellClick += (s, e) => { if (e.Column == 0) { _vm.EditColorsCommand?.Execute(e.Item); } }; gridView.CellFormatting += (sender, e) => { if (e.Column.ID == "Color") { e.BackgroundColor = (e.Item as ColorDataItem).Color; e.ForegroundColor = Eto.Drawing.Color.FromArgb(0, 0, 0); } }; return(gridView); }
private GridView GenGridView() { var gd = new GridView(); gd.Bind(_ => _.DataStore, _vm, _ => _.GridViewDataCollection); gd.SelectedItemsChanged += (s, e) => { _vm.SelectedData = gd.SelectedItem as ScheduleRulesetViewData; }; gd.Height = 250; var nameTB = new TextBoxCell { Binding = Binding.Delegate <ScheduleRulesetViewData, string>(r => r.Name) }; gd.Columns.Add(new GridColumn { DataCell = nameTB, HeaderText = "Name", Sortable = true }); var typeTB = new TextBoxCell { Binding = Binding.Delegate <ScheduleRulesetViewData, string>(r => r.TypeLimit) }; gd.Columns.Add(new GridColumn { DataCell = typeTB, HeaderText = "Type", Sortable = true }); gd.Columns.Add(new GridColumn { DataCell = new CheckBoxCell { Binding = Binding.Delegate <ScheduleRulesetViewData, bool?>(r => r.Locked) }, HeaderText = "Locked", Sortable = true }); gd.Columns.Add(new GridColumn { DataCell = new TextBoxCell { Binding = Binding.Delegate <ScheduleRulesetViewData, string>(r => r.Source) }, HeaderText = "Source", Sortable = true }); // sorting by header gd.ColumnHeaderClick += OnColumnHeaderClick; return(gd); }
public void AddColumn(string caption, int width, bool autoSize = false) { //if (autoSize) width = -1; //Columns.Add(caption, width, HorizontalAlignment.Left); var cell = new TextBoxCell(Columns.Count); GridColumn column = new GridColumn(); column.HeaderText = caption; column.DataCell = cell; column.AutoSize = autoSize; column.Width = width; Columns.Add(column); }
private Comparison <T> GetTextComparison(TextBoxCell textBoxCell) { return((first, second) => { string property1 = textBoxCell.Binding.GetValue(first); string property2 = textBoxCell.Binding.GetValue(second); // Try to compare as numbers if possible. Many columns will only contain numbers. if (long.TryParse(property1, out long value1) && long.TryParse(property2, out long value2)) { return value1.CompareTo(value2); } return String.Compare(property1, property2, StringComparison.Ordinal); }); }
private GridView GenProgramType_GV() { var gd = new GridView(); gd.Bind(_ => _.DataStore, _vm, _ => _.GridViewDataCollection); gd.SelectedItemsChanged += (s, e) => { _vm.SelectedData = gd.SelectedItem as ProgramTypeViewData; }; gd.Height = 250; var nameTB = new TextBoxCell { Binding = Binding.Delegate <ProgramTypeViewData, string>(r => r.Name) }; gd.Columns.Add(new GridColumn { DataCell = nameTB, HeaderText = "Name", Sortable = true }); var peopleTB = new CheckBoxCell { Binding = Binding.Delegate <ProgramTypeViewData, bool?>(r => r.HasPeople) }; gd.Columns.Add(new GridColumn { DataCell = peopleTB, HeaderText = "People", Sortable = true }); var lightingTB = new CheckBoxCell { Binding = Binding.Delegate <ProgramTypeViewData, bool?>(r => r.HasLighting) }; gd.Columns.Add(new GridColumn { DataCell = lightingTB, HeaderText = "Lighting", Sortable = true }); var equipTB = new CheckBoxCell { Binding = Binding.Delegate <ProgramTypeViewData, bool?>(r => r.HasElecEquip) }; gd.Columns.Add(new GridColumn { DataCell = equipTB, HeaderText = "ElecEquip", Sortable = true }); var gasTB = new CheckBoxCell { Binding = Binding.Delegate <ProgramTypeViewData, bool?>(r => r.HasGasEquip) }; gd.Columns.Add(new GridColumn { DataCell = gasTB, HeaderText = "GasEquip", Sortable = true }); var infTB = new CheckBoxCell { Binding = Binding.Delegate <ProgramTypeViewData, bool?>(r => r.HasInfiltration) }; gd.Columns.Add(new GridColumn { DataCell = infTB, HeaderText = "Infiltration", Sortable = true }); var ventTB = new CheckBoxCell { Binding = Binding.Delegate <ProgramTypeViewData, bool?>(r => r.HasVentilation) }; gd.Columns.Add(new GridColumn { DataCell = ventTB, HeaderText = "Ventilation", Sortable = true }); var setpointTB = new CheckBoxCell { Binding = Binding.Delegate <ProgramTypeViewData, bool?>(r => r.HasSetpoint) }; gd.Columns.Add(new GridColumn { DataCell = setpointTB, HeaderText = "Setpoint", Sortable = true }); var serviceHotWaterTB = new CheckBoxCell { Binding = Binding.Delegate <ProgramTypeViewData, bool?>(r => r.HasServiceHotWater) }; gd.Columns.Add(new GridColumn { DataCell = serviceHotWaterTB, HeaderText = "ServiceHotWater", Sortable = true }); gd.Columns.Add(new GridColumn { DataCell = new CheckBoxCell { Binding = Binding.Delegate <ProgramTypeViewData, bool?>(r => r.Locked) }, HeaderText = "Locked", Sortable = true }); gd.Columns.Add(new GridColumn { DataCell = new TextBoxCell { Binding = Binding.Delegate <ProgramTypeViewData, string>(r => r.Source) }, HeaderText = "Source", Sortable = true }); // sorting by header gd.ColumnHeaderClick += OnColumnHeaderClick; return(gd); }
public override void Initialize() { base.Initialize(); DataCell = new TextBoxCell(Widget.Generator); Editable = false; }
public Dialog_Construction(HB.ModelEnergyProperties libSource, HB.Energy.IConstruction construction, bool lockedMode = false) { try { this.ModelEnergyProperties = libSource; _hbObj = construction; Padding = new Padding(5); Resizable = true; Title = $"Construction - {DialogHelper.PluginName}"; WindowStyle = WindowStyle.Default; MinimumSize = new Size(650, 500); this.Icon = DialogHelper.HoneybeeIcon; var OkButton = new Button { Text = "OK", Enabled = !lockedMode }; OkButton.Click += (sender, e) => { // add new material to library source foreach (var layer in _layers) { var m = OpaqueMaterials.FirstOrDefault(_ => _.Identifier == layer); m = m ?? WindowMaterials.FirstOrDefault(_ => _.Identifier == layer); var dup = m.Duplicate() as HB.Energy.IMaterial; dup.DisplayName = m.DisplayName ?? m.Identifier; libSource.AddMaterial(dup); } OkCommand.Execute(_hbObj); }; AbortButton = new Button { Text = "Cancel" }; AbortButton.Click += (sender, e) => Close(); //var panel = new Panel_Schedule(sch); //panel.AddSeparateRow(null, OkButton, AbortButton, null); //Content = panel; var leftLayout = new DynamicLayout(); leftLayout.DefaultSpacing = new Size(5, 5); leftLayout.DefaultPadding = new Padding(5); leftLayout.Height = 600; leftLayout.AddRow("Name"); var name = new TextBox(); _hbObj.DisplayName = _hbObj.DisplayName ?? _hbObj.Identifier; name.TextBinding.Bind(() => _hbObj.DisplayName, v => _hbObj.DisplayName = v); leftLayout.AddRow(name); var groupContent = new DynamicLayout(); groupContent.DefaultSpacing = new Size(5, 5); Action <int, string> actionWhenItemChanged = (int layerIndex, string newValue) => { _layers.RemoveAt(layerIndex); _layers.Insert(layerIndex, newValue); CalRValue(_hbObj, _showIP); }; _layersPanel = new DynamicLayout(); _layersPanel.DefaultSpacing = new Size(5, 5); GenMaterialLayersPanel(_layersPanel, actionWhenItemChanged); var fromLibDropin = GenAddMoreDropInArea( (newValue) => { var newIndex = _layers.Count; _layers.Add(newValue); GenMaterialLayersPanel(_layersPanel, actionWhenItemChanged); _layersPanel.Create(); CalRValue(_hbObj, _showIP); } ); groupContent.AddSeparateRow(null, "Outside", null); groupContent.AddRow(_layersPanel); groupContent.AddRow(fromLibDropin); groupContent.AddSeparateRow(null, "Inside", null); //group.Content = groupContent; leftLayout.AddRow(groupContent); leftLayout.AddRow(null); //leftLayout.AddAutoSized(new Button()); //leftLayout.AddSeparateRow(new Button()); // Thermal properties var thermGp = new GroupBox() { Text = "Construction Thermal Properties" }; var thermProp = new DynamicLayout() { DefaultPadding = new Padding(4) }; //thermProp.AddSeparateRow("Construction Thermal Properties", null); _r_label = new Label() { Text = _r_si }; _u_label = new Label() { Text = _u_si }; _uf_label = new Label() { Text = _uf_si }; _r_value = new Label() { Text = "Not available" }; _u_value = new Label() { Text = "Not available" }; _uf_value = new Label() { Text = "Not available" }; thermProp.AddSeparateRow(_r_label, ":", _r_value); thermProp.AddSeparateRow(_u_label, ":", _u_value); thermProp.AddSeparateRow(_uf_label, ":", _uf_value); CalRValue(_hbObj, false); // unit switchs var unit = new RadioButtonList(); unit.Items.Add("Metric"); unit.Items.Add("Imperial"); unit.SelectedIndex = 0; unit.Spacing = new Size(5, 0); unit.SelectedIndexChanged += (s, e) => CalRValue(_hbObj, unit.SelectedIndex == 1); thermProp.AddSeparateRow("Unit:", unit); thermGp.Content = thermProp; leftLayout.AddRow(thermGp); leftLayout.AddRow(null); var buttonSource = new Button { Text = "Schema Data" }; buttonSource.Click += (s, e) => { Dialog_Message.Show(this, _hbObj.ToJson(true)); }; //leftLayout.AddRow(null); //Right panel var rightGroup = new GroupBox(); rightGroup.Text = "Library"; var groupPanel = new DynamicLayout(); var materialType = new DropDown(); materialType.Items.Add(new ListItem() { Key = "Opaque", Text = "Opaque Material" }); materialType.Items.Add(new ListItem() { Key = "Window", Text = "Window Material" }); //constructionTypes.Items.Add(new ListItem() { Key = "Shade Material" }); //constructionTypes.Items.Add(new ListItem() { Key = "AirBoundary Material" }); materialType.SelectedIndex = 0; groupPanel.AddRow(materialType); //Search tbox var searchTBox = new TextBox() { PlaceholderText = "Search" }; groupPanel.AddRow(searchTBox); var allMaterials = OpaqueMaterials; // Library var lib = new GridView(); lib.Height = 400; groupPanel.AddRow(lib); lib.ShowHeader = false; var nameCol = new GridColumn() { DataCell = new TextBoxCell(0) }; lib.Columns.Add(nameCol); // Library items lib.DataStore = allMaterials; var idCell = new TextBoxCell { Binding = Binding.Delegate <HB.Energy.IIDdEnergyBaseModel, string>(r => r.DisplayName ?? r.Identifier) }; lib.Columns.Add(new GridColumn() { DataCell = idCell }); // material details var detailPanel = new DynamicLayout(); var materialDetail = new TextArea(); materialDetail.Height = 150; materialDetail.Text = "Material Details"; //groupPanel.AddRow(materialDetail); var rightSplit = new Splitter(); rightSplit.Panel1 = groupPanel; rightSplit.Panel2 = materialDetail; rightSplit.Panel1MinimumSize = 300; rightSplit.Orientation = Orientation.Vertical; rightGroup.Content = rightSplit; materialType.SelectedIndexChanged += (sender, e) => { var selectedType = materialType.SelectedKey; allMaterials = selectedType == "Window" ? this.WindowMaterials : this.OpaqueMaterials; searchTBox.Text = null; //lib.Items.Clear(); lib.DataStore = allMaterials; //var filteredItems = allMaterials.Select(_ => new ListItem() { Text = _.Identifier, Key = _.Identifier, Tag = _ }); //lib.Items.AddRange(filteredItems); }; //// need this to make drag drop work on Mac //lib.MouseDown += (sender, e) => { // _primMousePressed = e.Buttons == MouseButtons.Primary; //}; //lib.MouseUp += (sender, e) => { // _primMousePressed = false; //}; lib.MouseMove += (sender, e) => { if (e.Buttons != MouseButtons.Primary) { return; } if (lib.SelectedItem == null) { return; } var dragableArea = lib.Bounds; dragableArea.Width -= 20; dragableArea.Height -= 20; var iscontained = e.Location.Y < dragableArea.Height && e.Location.X < dragableArea.Width; //name.Text = $"{dragableArea.Width}x{dragableArea.Height}, {new Point(e.Location).X}:{new Point(e.Location).Y}, {dragableArea.Contains(new Point(e.Location))}"; if (!iscontained) { return; } var cell = lib.GetCellAt(e.Location); if (cell.RowIndex == -1 || cell.ColumnIndex == -1) { return; } var selected = (lib.SelectedItem as HB.Energy.IMaterial).Identifier; var data = new DataObject(); data.SetString(selected, "HBObj"); lib.DoDragDrop(data, DragEffects.Move); e.Handled = true; }; lib.SelectedItemsChanged += (s, e) => { //Clear preview first materialDetail.Text = null; //Check current selected item from library var selItem = lib.SelectedItem as HB.HoneybeeObject; if (selItem == null) { return; } //Update Preview materialDetail.Text = selItem.ToString(true); }; searchTBox.TextChanged += (sender, e) => { var input = searchTBox.Text; materialDetail.Text = null; if (string.IsNullOrWhiteSpace(input)) { lib.DataStore = allMaterials; return; } var regexPatten = ".*" + input.Replace(" ", "(.*)") + ".*"; var filtered = allMaterials.Where(_ => Regex.IsMatch(_.Identifier, regexPatten, RegexOptions.IgnoreCase) || (_.DisplayName != null ? Regex.IsMatch(_.DisplayName, regexPatten, RegexOptions.IgnoreCase) : false)); lib.DataStore = filtered; }; //var split = new Splitter(); //split.Orientation = Orientation.Horizontal; //split.Panel1 = leftLayout; //split.Panel2 = rightGroup; var locked = new CheckBox() { Text = "Locked", Enabled = false }; locked.Checked = lockedMode; var layout = new DynamicLayout(); layout.DefaultSpacing = new Size(5, 5); layout.DefaultPadding = new Padding(5); layout.AddSeparateRow(leftLayout, rightGroup); layout.AddSeparateRow(locked, null, OkButton, AbortButton, null, buttonSource); layout.AddRow(null); //Create layout Content = layout; } catch (Exception e) { throw e; } }
protected override void Initialize() { base.Initialize(); DataCell = new TextBoxCell(Widget.Generator); }