void InitializeProjectsListView() { projectStore?.Clear(); // Recreate the list view each time. This is a workaround for the // list view not displaying items on re-populating if it has been sorted. if (projectsListView != null) { projectsListViewVBox.Remove(projectsListView); projectsListView.Dispose(); } projectStore?.Dispose(); projectCheckedField = new DataField <bool> (); projectNameField = new DataField <string> (); packageVersionField = new DataField <string> (); projectField = new DataField <ManageProjectViewModel> (); projectStore = new ListStore(projectCheckedField, projectNameField, packageVersionField, projectField); projectsListView = new ListView(); projectsListView.DataSource = projectStore; // Selected project check box column. if (projectCheckBoxCellView != null) { projectCheckBoxCellView.Toggled -= ProjectCheckBoxCellViewToggled; } projectCheckBoxCellView = new CheckBoxCellView(); projectCheckBoxCellView.ActiveField = projectCheckedField; projectCheckBoxCellView.Editable = true; projectCheckBoxCellView.Toggled += ProjectCheckBoxCellViewToggled; var column = new ListViewColumn(string.Empty, projectCheckBoxCellView); projectsListView.Columns.Add(column); // Project column. var textCellView = new TextCellView(); textCellView.TextField = projectNameField; column = new ListViewColumn(GettextCatalog.GetString("Project"), textCellView) { CanResize = true, SortDataField = projectNameField }; projectsListView.Columns.Add(column); // Package version column textCellView = new TextCellView(); textCellView.TextField = packageVersionField; column = new ListViewColumn(GettextCatalog.GetString("Version"), textCellView) { CanResize = true, SortDataField = packageVersionField }; projectsListView.Columns.Add(column); // Add list view to dialog. projectsListViewVBox.PackStart(projectsListView, true, true); }
public EnvironmentVariableCollectionEditor() { store = new ListStore(keyField, valueField); list = new ListView(store); PackStart(list, true); TextCellView crt = new TextCellView(); crt.Editable = true; crt.TextField = keyField; var col = list.Columns.Add(GettextCatalog.GetString("Variable"), crt); col.CanResize = true; crt.TextChanged += (s, a) => NotifyChanged(); valueCell = new TextCellView(); valueCell.Editable = true; valueCell.TextField = valueField; col = list.Columns.Add(GettextCatalog.GetString("Value"), valueCell); col.CanResize = true; valueCell.TextChanged += (s, a) => NotifyChanged(); var box = new HBox(); var btn = new Button(GettextCatalog.GetString("Add")); btn.Clicked += delegate { var row = store.AddRow(); list.SelectRow(row); list.StartEditingCell(row, crt); crt.TextChanged += CrtTextChanged; UpdateButtons(); }; box.PackStart(btn); deleteButton = new Button(GettextCatalog.GetString("Remove")); deleteButton.Clicked += delegate { var row = list.SelectedRow; if (row != -1) { store.RemoveRow(row); if (row < store.RowCount) { list.SelectRow(row); } else if (store.RowCount > 0) { list.SelectRow(store.RowCount - 1); } UpdateButtons(); NotifyChanged(); } }; box.PackStart(deleteButton); PackStart(box); UpdateButtons(); }
void AddTextColumn(DataField <string> dataField, string columnTitle) { var column = new ListViewColumn(); column.Title = columnTitle; var textViewCell = new TextCellView(); textViewCell.TextField = dataField; column.Views.Add(textViewCell); column.CanResize = true; listView.Columns.Add(column); }
protected override AView GetCellCore(Cell item, AView convertView, ViewGroup parent, Context context) { if ((View = convertView as TextCellView) == null) View = new TextCellView(context, item); UpdateMainText(); UpdateDetailText(); UpdateHeight(); UpdateIsEnabled(); View.SetImageVisible(false); return View; }
internal static FrameworkElementFactory CreateBoundCellRenderer(CellView view, string dataPath = ".") { TextCellView textView = view as TextCellView; if (textView != null) { FrameworkElementFactory factory = new FrameworkElementFactory(typeof(SWC.TextBlock)); factory.SetValue(FrameworkElement.MarginProperty, CellMargins); if (textView.TextField != null) { factory.SetBinding(SWC.TextBlock.TextProperty, new Binding(dataPath + "[" + textView.TextField.Index + "]")); } return(factory); } ImageCellView imageView = view as ImageCellView; if (imageView != null) { FrameworkElementFactory factory = new FrameworkElementFactory(typeof(ImageBox)); factory.SetValue(FrameworkElement.MarginProperty, CellMargins); if (imageView.ImageField != null) { var binding = new Binding(dataPath + "[" + imageView.ImageField.Index + "]") { Converter = new ImageToImageSourceConverter() }; factory.SetBinding(ImageBox.ImageSourceProperty, binding); } return(factory); } CanvasCellView canvasView = view as CanvasCellView; if (canvasView != null) { FrameworkElementFactory factory = new FrameworkElementFactory(typeof(CanvasCellViewBackend)); factory.SetValue(FrameworkElement.MarginProperty, CellMargins); factory.SetValue(CanvasCellViewBackend.CellViewProperty, view); return(factory); } throw new NotImplementedException(); }
protected void AddTextColumn(DataField <string> dataField, string columnTitle, IDataField sortDataField = null) { var column = new ListViewColumn(); column.Title = columnTitle; column.SortDataField = sortDataField ?? dataField; var textViewCell = new TextCellView(); textViewCell.TextField = dataField; column.Views.Add(textViewCell); column.CanResize = true; listView.Columns.Add(column); }
public override Control CreatePanelWidget() { var vbox = new VBox(); vbox.Spacing = 6; featuresListStore = new ListStore(featureNameDataField, featureEnabledDataField, featureDataField); featuresListView = new ListView(); featuresListView.DataSource = featuresListStore; var cellView = new TextCellView(); cellView.TextField = featureNameDataField; var column = new ListViewColumn("Feature", cellView); featuresListView.Columns.Add(column); var featuresComboBoxDataSource = new List <string> (); var checkBoxCellView = new CheckBoxCellView(); checkBoxCellView.Editable = true; checkBoxCellView.ActiveField = featureEnabledDataField; checkBoxCellView.Toggled += FeatureEnabledCheckBoxToggled; column = new ListViewColumn("Enabled", checkBoxCellView); featuresListView.Columns.Add(column); vbox.PackStart(featuresListView, true, true); var restartLabel = new Label(); restartLabel.Text = GettextCatalog.GetString("Some features may require a restart of {0}", BrandingService.ApplicationName); restartLabel.TextAlignment = Alignment.Start; vbox.PackStart(restartLabel); var restartButtonHBox = new HBox(); vbox.PackStart(restartButtonHBox, false, false); restartButton = new Button(); restartButton.Label = GettextCatalog.GetString("Restart {0}", BrandingService.ApplicationName); restartButtonHBox.PackStart(restartButton, false, false); restartButton.Clicked += RestartButtonClicked; AddFeatures(); widget = vbox.ToGtkWidget(); return(widget); }
protected override AView GetCellCore(Cell item, AView convertView, ViewGroup parent, Context context) { if ((View = convertView as TextCellView) == null) { View = new TextCellView(context, item); } UpdateMainText(); UpdateDetailText(); UpdateHeight(); UpdateIsEnabled(); View.SetImageVisible(false); return(View); }
void Build() { treeView = new TreeView(); treeView.HeadersVisible = false; treeStore = new TreeStore(textDataField, imageDataField, viewModelDataField); treeView.DataSource = treeStore; var column = new ListViewColumn("Node"); column.Views.Add(new ImageCellView(imageDataField)); var cellView = new TextCellView(); cellView.MarkupField = textDataField; column.Views.Add(cellView); treeView.Columns.Add(column); Content = treeView; }
public RunConfigurationsList() { listStore = new Xwt.ListStore(configCol, configNameCol, configIconCol); list = new Xwt.ListView(listStore); list.HeadersVisible = false; var imgCell = new ImageCellView { ImageField = configIconCol }; var textCell = new TextCellView { MarkupField = configNameCol }; list.Columns.Add(GettextCatalog.GetString("Name"), imgCell, textCell); Content = list; list.SelectionChanged += (s, o) => SelectionChanged?.Invoke(this, o); list.RowActivated += (s, o) => RowActivated?.Invoke(this, o); }
internal static FrameworkElementFactory CreateBoundCellRenderer(CellView view) { TextCellView textView = view as TextCellView; if (textView != null) { FrameworkElementFactory factory = new FrameworkElementFactory(typeof(SWC.TextBlock)); if (textView.TextField != null) { factory.SetBinding(SWC.TextBlock.TextProperty, new Binding(".[" + textView.TextField.Index + "]")); } factory.SetValue(SWC.Control.PaddingProperty, new Thickness(2)); return(factory); } ImageCellView imageView = view as ImageCellView; if (imageView != null) { FrameworkElementFactory factory = new FrameworkElementFactory(typeof(SWC.Image)); if (imageView.ImageField != null) { var binding = new Binding(".[" + imageView.ImageField.Index + "]") { Converter = new ImageToImageSourceConverter() }; factory.SetBinding(SWC.Image.SourceProperty, binding); } return(factory); } throw new NotImplementedException(); }
public ListViewEntries() { ListView list = new ListView(); var editableTextField = new DataField <string> (); var nonEditableTextField = new DataField <string> (); ListStore store = new ListStore(editableTextField, nonEditableTextField); list.DataSource = store; list.GridLinesVisible = GridLines.Horizontal; var textCellView = new TextCellView { Editable = true, TextField = editableTextField }; list.Columns.Add(new ListViewColumn("Editable", textCellView)); list.Columns.Add(new ListViewColumn("Not Editable", new TextCellView { Editable = false, TextField = nonEditableTextField })); Random rand = new Random(); for (int n = 0; n < 10; n++) { var r = store.AddRow(); store.SetValue(r, editableTextField, "Editable value " + n); store.SetValue(r, nonEditableTextField, "Non-editable value " + n); } PackStart(list, true); var btn = new Button("Add Row"); btn.Clicked += delegate { var row = store.AddRow(); store.SetValues(row, editableTextField, "New editable text", nonEditableTextField, "New non-editable text"); list.StartEditingCell(row, textCellView); }; PackStart(btn, false, hpos: WidgetPlacement.Start); }
void IOptionsPanel.Initialize(OptionsDialog dialog, object dataObject) { this.ExpandHorizontal = true; this.ExpandVertical = true; this.HeightRequest = 400; list = new ListView(); store = new ListStore(language, completeOnSpace, completeOnChars); var languageColumn = list.Columns.Add(GettextCatalog.GetString("Language"), language); languageColumn.CanResize = true; var checkBoxCellView = new CheckBoxCellView(completeOnSpace); checkBoxCellView.Editable = true; var completeOnSpaceColumn = list.Columns.Add(GettextCatalog.GetString("Complete on space"), checkBoxCellView); completeOnSpaceColumn.CanResize = true; var textCellView = new TextCellView(completeOnChars); textCellView.Editable = true; var doNotCompleteOnColumn = list.Columns.Add(GettextCatalog.GetString("Do complete on"), textCellView); doNotCompleteOnColumn.CanResize = true; list.DataSource = store; PackStart(list, true, true); var hbox = new HBox(); var button = new Button("Reset to default"); button.Clicked += delegate { FillStore(CompletionCharacters.GetDefaultCompletionCharacters()); }; hbox.PackEnd(button, false, false); PackEnd(hbox, false, true); FillStore(CompletionCharacters.GetCompletionCharacters()); }
internal static FrameworkElementFactory CreateBoundCellRenderer(CellView view, string dataPath = ".") { TextCellView textView = view as TextCellView; if (textView != null) { // if it's an editable textcontrol, use a TextBox, if not use a TextBlock. Reason for this is that // a user usually expects to be able to edit a text if a text cursor is appearing above a field. FrameworkElementFactory factory; if (textView.EditableField == null) { if (textView.Editable) { factory = new FrameworkElementFactory(typeof(SWC.TextBox)); factory.SetValue(FrameworkElement.MarginProperty, CellMargins); factory.SetValue(SWC.TextBox.IsReadOnlyProperty, false); if (textView.TextField != null) { factory.SetBinding(SWC.TextBox.TextProperty, new Binding(dataPath + "[" + textView.TextField.Index + "]")); } } else { factory = new FrameworkElementFactory(typeof(SWC.TextBlock)); factory.SetValue(FrameworkElement.MarginProperty, CellMargins); if (textView.TextField != null) { factory.SetBinding(SWC.TextBlock.TextProperty, new Binding(dataPath + "[" + textView.TextField.Index + "]")); } } } else { factory = new FrameworkElementFactory(typeof(SWC.TextBox)); factory.SetValue(FrameworkElement.MarginProperty, CellMargins); factory.SetBinding(SWC.TextBox.IsEnabledProperty, new Binding(dataPath + "[" + textView.EditableField.Index + "]")); if (textView.TextField != null) { factory.SetBinding(SWC.TextBox.TextProperty, new Binding(dataPath + "[" + textView.TextField.Index + "]")); } } return(factory); } ImageCellView imageView = view as ImageCellView; if (imageView != null) { FrameworkElementFactory factory = new FrameworkElementFactory(typeof(ImageBox)); factory.SetValue(FrameworkElement.MarginProperty, CellMargins); if (imageView.ImageField != null) { var binding = new Binding(dataPath + "[" + imageView.ImageField.Index + "]") { Converter = new ImageToImageSourceConverter() }; factory.SetBinding(ImageBox.ImageSourceProperty, binding); } return(factory); } CanvasCellView canvasView = view as CanvasCellView; if (canvasView != null) { FrameworkElementFactory factory = new FrameworkElementFactory(typeof(CanvasCellViewBackend)); factory.SetValue(FrameworkElement.MarginProperty, CellMargins); factory.SetValue(CanvasCellViewBackend.CellViewProperty, view); return(factory); } CheckBoxCellView cellView = view as CheckBoxCellView; if (cellView != null) { FrameworkElementFactory factory = new FrameworkElementFactory(typeof(SWC.CheckBox)); if (cellView.EditableField == null) { factory.SetValue(FrameworkElement.IsEnabledProperty, cellView.Editable); } else { factory.SetBinding(SWC.CheckBox.IsEnabledProperty, new Binding(dataPath + "[" + cellView.EditableField.Index + "]")); } factory.SetValue(SWC.CheckBox.IsThreeStateProperty, cellView.AllowMixed); factory.SetValue(FrameworkElement.MarginProperty, CellMargins); if (cellView.ActiveField != null) { factory.SetBinding(SWC.CheckBox.IsCheckedProperty, new Binding(dataPath + "[" + cellView.ActiveField.Index + "]")); } return(factory); } throw new NotImplementedException(); }
public void CopyFrom(object other) { var ob = (TextTableCell)other; cellView = ob.cellView; }
public TextTableCell(TextCellView cellView) { this.cellView = cellView; }
private void BuildGui() { this.Resizable = false; _nameEntry.WidthRequest = _ownerEntry.WidthRequest = _computerEntry.WidthRequest = 400; VBox content = new VBox(); Table entryTable = new Table(); entryTable.Add(new Label(GettextCatalog.GetString("Name") + ":"), 0, 0); entryTable.Add(_nameEntry, 1, 0); entryTable.Add(new Label(GettextCatalog.GetString("Owner") + ":"), 0, 1); entryTable.Add(_ownerEntry, 1, 1); entryTable.Add(new Label(GettextCatalog.GetString("Computer") + ":"), 0, 2); entryTable.Add(_computerEntry, 1, 2); // entryTable.Add(new Label(GettextCatalog.GetString("Permissions") + ":"), 0, 3); // _permissions.Items.Add(0, "Private workspace"); // _permissions.Items.Add(1, "Public workspace (limited)"); // _permissions.Items.Add(2, "Public workspace"); // entryTable.Add(_permissions, 1, 3); content.PackStart(entryTable); content.PackStart(new Label(GettextCatalog.GetString("Comment") + ":")); _commentEntry.MultiLine = true; //Not working yet content.PackStart(_commentEntry); content.PackStart(new Label(GettextCatalog.GetString("Working folders") + ":")); _workingFoldersView.DataSource = _workingFoldersStore; _workingFoldersView.MinHeight = 150; _workingFoldersView.MinWidth = 300; var tfsFolderView = new TextCellView(_tfsFolder); tfsFolderView.Editable = true; var localFolderView = new TextCellView(_localFolder); _workingFoldersView.Columns.Add(new ListViewColumn("Source Control Floder", tfsFolderView)); _workingFoldersView.Columns.Add(new ListViewColumn("Local Floder", localFolderView)); content.PackStart(_workingFoldersView); HBox buttonBox = new HBox(); Button addButton = new Button(GettextCatalog.GetString("Add")); addButton.MinWidth = Constants.ButtonWidth; addButton.Clicked += OnAddWorkingFolder; Button removeButton = new Button(GettextCatalog.GetString("Remove")); removeButton.MinWidth = Constants.ButtonWidth; removeButton.Clicked += OnRemoveWorkingFolder; Button okButton = new Button(GettextCatalog.GetString("OK")); okButton.MinWidth = Constants.ButtonWidth; okButton.Clicked += OnAddEditWorkspace; Button cancelButton = new Button(GettextCatalog.GetString("Cancel")); cancelButton.MinWidth = Constants.ButtonWidth; cancelButton.Clicked += (sender, e) => Respond(Command.Cancel); buttonBox.PackStart(addButton); buttonBox.PackStart(removeButton); buttonBox.PackEnd(okButton); buttonBox.PackEnd(cancelButton); content.PackStart(buttonBox); this.Content = content; if (_action == DialogAction.Create) { this.Title = "Add Workspace" + " - " + projectCollection.Server.Name + " - " + projectCollection.Name; FillFieldsDefault(); } else { this.Title = "Edit Workspace " + _workspace.Name + " - " + projectCollection.Server.Name + " - " + projectCollection.Name; FillFields(); FillWorkingFolders(); } }
void Build() { Title = GettextCatalog.GetString("User Extensions"); Height = 480; Width = 640; var mainHBox = new HBox(); addinImageField = new DataField <Image> (); addinNameField = new DataField <string> (); addinField = new DataField <Addin> (); addinsListStore = new ListStore(addinImageField, addinNameField, addinField); addinsListView = new ListView(); addinsListView.HeadersVisible = false; addinsListView.SelectionMode = SelectionMode.Multiple; addinsListView.DataSource = addinsListStore; mainHBox.PackStart(addinsListView, true, true); var column = new ListViewColumn(); var imageCellView = new ImageCellView(); imageCellView.ImageField = addinImageField; column.Views.Add(imageCellView); var cellView = new TextCellView(); cellView.MarkupField = addinNameField; column.Views.Add(cellView); addinsListView.Columns.Add(column); var buttonVBox = new VBox(); enableButton = new Button(); enableButton.Label = GettextCatalog.GetString("Enable"); buttonVBox.PackStart(enableButton); disableButton = new Button(); disableButton.Label = GettextCatalog.GetString("Disable"); buttonVBox.PackStart(disableButton); var separator = new HSeparator(); buttonVBox.PackStart(separator); enableAllButton = new Button(); enableAllButton.Label = GettextCatalog.GetString("Enable All"); buttonVBox.PackStart(enableAllButton); disableAllButton = new Button(); disableAllButton.Label = GettextCatalog.GetString("Disable All"); buttonVBox.PackStart(disableAllButton); separator = new HSeparator(); buttonVBox.PackStart(separator); restartButton = new Button(); restartButton.Label = GettextCatalog.GetString("Restart {0}", BrandingService.ApplicationName); buttonVBox.PackStart(restartButton); mainHBox.PackStart(buttonVBox, false, false); Content = mainHBox; var closeButton = new DialogButton(Command.Close); closeButton.Clicked += CloseButtonClicked; Buttons.Add(closeButton); }
internal static FrameworkElementFactory CreateBoundCellRenderer(ApplicationContext ctx, WidgetBackend parent, CellView view, string dataPath = ".") { ICellViewFrontend fr = view; TextCellView textView = view as TextCellView; if (textView != null) { // if it's an editable textcontrol, use a TextBox, if not use a TextBlock. Reason for this is that // a user usually expects to be able to edit a text if a text cursor is appearing above a field. FrameworkElementFactory factory; if (textView.Editable || textView.EditableField != null) { factory = new FrameworkElementFactory(typeof(SWC.TextBox)); if (textView.Editable) { factory.SetValue(SWC.TextBox.IsReadOnlyProperty, false); } else { factory.SetBinding(SWC.TextBox.IsEnabledProperty, new Binding(dataPath + "[" + textView.EditableField.Index + "]")); } if (textView.TextField != null) { factory.SetBinding(SWC.TextBox.TextProperty, new Binding(dataPath + "[" + textView.TextField.Index + "]")); } else { factory.SetValue(SWC.TextBox.TextProperty, textView.Text); } } else { factory = new FrameworkElementFactory(typeof(SWC.TextBlock)); if (textView.MarkupField != null) { factory.SetBinding(SWC.TextBlock.TextProperty, new Binding(dataPath + "[" + textView.MarkupField.Index + "]") { Converter = new MarkupToPlainTextConverter() }); } else if (textView.TextField != null) { factory.SetBinding(SWC.TextBlock.TextProperty, new Binding(dataPath + "[" + textView.TextField.Index + "]")); } else { factory.SetValue(SWC.TextBlock.TextProperty, textView.Text); } } var cb = new TextCellViewBackend(); cb.Initialize(view, factory, parent as ICellRendererTarget); fr.AttachBackend(parent.Frontend, cb); return(factory); } ImageCellView imageView = view as ImageCellView; if (imageView != null) { FrameworkElementFactory factory = new FrameworkElementFactory(typeof(ImageBox)); if (imageView.ImageField != null) { var binding = new Binding(dataPath + "[" + imageView.ImageField.Index + "]"); binding.Converter = new ImageToImageSourceConverter(ctx); factory.SetBinding(ImageBox.ImageSourceProperty, binding); } var cb = new CellViewBackend(); cb.Initialize(view, factory, parent as ICellRendererTarget); fr.AttachBackend(parent.Frontend, cb); return(factory); } CanvasCellView canvasView = view as CanvasCellView; if (canvasView != null) { var cb = new CanvasCellViewBackend(); FrameworkElementFactory factory = new FrameworkElementFactory(typeof(CanvasCellViewPanel)); factory.SetValue(CanvasCellViewPanel.CellViewBackendProperty, cb); cb.Initialize(view, factory, parent as ICellRendererTarget); fr.AttachBackend(parent.Frontend, cb); return(factory); } CheckBoxCellView cellView = view as CheckBoxCellView; if (cellView != null) { FrameworkElementFactory factory = new FrameworkElementFactory(typeof(SWC.CheckBox)); if (cellView.EditableField == null) { factory.SetValue(FrameworkElement.IsEnabledProperty, cellView.Editable); } else { factory.SetBinding(SWC.CheckBox.IsEnabledProperty, new Binding(dataPath + "[" + cellView.EditableField.Index + "]")); } factory.SetValue(SWC.CheckBox.IsThreeStateProperty, cellView.AllowMixed); if (cellView.ActiveField != null) { factory.SetBinding(SWC.CheckBox.IsCheckedProperty, new Binding(dataPath + "[" + cellView.ActiveField.Index + "]")); } var cb = new CheckBoxCellViewBackend(); cb.Initialize(view, factory, parent as ICellRendererTarget); fr.AttachBackend(parent.Frontend, cb); return(factory); } throw new NotImplementedException(); }