void OnRemoveWorkItem(object sender, EventArgs e) { if (workItemsView.SelectedRow > -1) { workItemsStore.RemoveRow(workItemsView.SelectedRow); } }
public void Remove(int row) { var item = store.GetValue(row, itemDataField); List.Remove(item); store.RemoveRow(row); }
private void OnRemoveWorkingFolder(object sender, EventArgs e) { if (_workingFoldersView.SelectedRow < 0) { return; } _workingFoldersStore.RemoveRow(_workingFoldersView.SelectedRow); }
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(); }
protected void Button_minus_Clicked(object sender, EventArgs e) { if (listView1.SelectedRows.Length == 0) { return; } listStore.RemoveRow(listView1.SelectedRow); }
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 (); }
public SinglePlayerView(LauncherWindow window) { Worlds.Local = new Worlds(); Worlds.Local.Load(); Window = window; MinWidth = 250; SinglePlayerLabel = new Label("SinglePlayer") { Font = Font.WithSize(16), TextAlignment = Alignment.Center }; WorldListView = new ListView { MinHeight = 200, SelectionMode = SelectionMode.Single }; CreateWorldButton = new Button("New world"); DeleteWorldButton = new Button("Delete") {Sensitive = false}; PlayButton = new Button("Play") {Sensitive = false}; BackButton = new Button("Back"); CreateWorldBox = new VBox {Visible = false}; NewWorldName = new TextEntry {PlaceholderText = "Name"}; NewWorldSeed = new TextEntry {PlaceholderText = "Seed (optional)"}; NewWorldCommit = new Button("Create") {Sensitive = false}; NewWorldCancel = new Button("Cancel"); NameField = new DataField<string>(); WorldListStore = new ListStore(NameField); WorldListView.DataSource = WorldListStore; WorldListView.HeadersVisible = false; WorldListView.Columns.Add(new ListViewColumn("Name", new TextCellView {TextField = NameField, Editable = false})); ProgressLabel = new Label("Loading world...") {Visible = false}; ProgressBar = new ProgressBar {Visible = false, Indeterminate = true, Fraction = 0}; BackButton.Clicked += (sender, e) => { Window.InteractionBox.Remove(this); Window.InteractionBox.PackEnd(Window.MainMenuView); }; CreateWorldButton.Clicked += (sender, e) => { CreateWorldBox.Visible = true; }; NewWorldCancel.Clicked += (sender, e) => { CreateWorldBox.Visible = false; }; NewWorldName.Changed += (sender, e) => { NewWorldCommit.Sensitive = !string.IsNullOrEmpty(NewWorldName.Text); }; NewWorldCommit.Clicked += NewWorldCommit_Clicked; WorldListView.SelectionChanged += (sender, e) => { PlayButton.Sensitive = DeleteWorldButton.Sensitive = WorldListView.SelectedRow != -1; }; PlayButton.Clicked += PlayButton_Clicked; DeleteWorldButton.Clicked += (sender, e) => { var world = Worlds.Local.Saves[WorldListView.SelectedRow]; WorldListStore.RemoveRow(WorldListView.SelectedRow); Worlds.Local.Saves = Worlds.Local.Saves.Where(s => s != world).ToArray(); Directory.Delete(world.BaseDirectory, true); }; foreach (var world in Worlds.Local.Saves) { var row = WorldListStore.AddRow(); WorldListStore.SetValue(row, NameField, world.Name); } var createDeleteHbox = new HBox(); CreateWorldButton.WidthRequest = DeleteWorldButton.WidthRequest = 0.5; createDeleteHbox.PackStart(CreateWorldButton, true); createDeleteHbox.PackStart(DeleteWorldButton, true); CreateWorldBox.PackStart(NewWorldName); CreateWorldBox.PackStart(NewWorldSeed); var newWorldHbox = new HBox(); NewWorldCommit.WidthRequest = NewWorldCancel.WidthRequest = 0.5; newWorldHbox.PackStart(NewWorldCommit, true); newWorldHbox.PackStart(NewWorldCancel, true); CreateWorldBox.PackStart(newWorldHbox); PackStart(SinglePlayerLabel); PackStart(WorldListView); PackStart(createDeleteHbox); PackStart(PlayButton); PackStart(CreateWorldBox); PackStart(ProgressLabel); PackStart(ProgressBar); PackEnd(BackButton); }
public MultiplayerView(LauncherWindow window) { Window = window; this.MinWidth = 250; MultiplayerLabel = new Label("Multiplayer") { Font = Font.WithSize(16), TextAlignment = Alignment.Center }; ServerIPEntry = new TextEntry() { PlaceholderText = "Server IP", Text = UserSettings.Local.LastIP }; ConnectButton = new Button("Connect"); BackButton = new Button("Back"); ServerListView = new ListView() { MinHeight = 200, SelectionMode = SelectionMode.Single }; AddServerButton = new Button("Add server"); RemoveServerButton = new Button("Remove") { Sensitive = false }; ServerCreationBox = new VBox() { Visible = false }; NewServerLabel = new Label("Add new server:") { TextAlignment = Alignment.Center }; NewServerName = new TextEntry() { PlaceholderText = "Name" }; NewServerAddress = new TextEntry() { PlaceholderText = "Address" }; CommitAddNewServer = new Button("Add server"); CancelAddNewServer = new Button("Cancel"); var iconField = new DataField <Image>(); var nameField = new DataField <string>(); var playersField = new DataField <string>(); ServerListStore = new ListStore(iconField, nameField, playersField); ServerListView.DataSource = ServerListStore; ServerListView.HeadersVisible = false; ServerListView.Columns.Add(new ListViewColumn("Icon", new ImageCellView { ImageField = iconField })); ServerListView.Columns.Add(new ListViewColumn("Name", new TextCellView { TextField = nameField })); ServerListView.Columns.Add(new ListViewColumn("Players", new TextCellView { TextField = playersField })); ServerIPEntry.KeyReleased += (sender, e) => { if (e.Key == Key.Return || e.Key == Key.NumPadEnter) { ConnectButton_Clicked(sender, e); } }; BackButton.Clicked += (sender, e) => { Window.MainContainer.Remove(this); Window.MainContainer.PackEnd(Window.MainMenuView); }; ConnectButton.Clicked += ConnectButton_Clicked; ServerListView.SelectionChanged += (sender, e) => { RemoveServerButton.Sensitive = ServerListView.SelectedRow != -1; ServerIPEntry.Sensitive = ServerListView.SelectedRow == -1; }; AddServerButton.Clicked += (sender, e) => { AddServerButton.Sensitive = false; RemoveServerButton.Sensitive = false; ConnectButton.Sensitive = false; ServerListView.Sensitive = false; ServerIPEntry.Sensitive = false; ServerCreationBox.Visible = true; }; CancelAddNewServer.Clicked += (sender, e) => { AddServerButton.Sensitive = true; RemoveServerButton.Sensitive = true; ConnectButton.Sensitive = true; ServerListView.Sensitive = true; ServerIPEntry.Sensitive = true; ServerCreationBox.Visible = false; }; RemoveServerButton.Clicked += (sender, e) => { var server = UserSettings.Local.FavoriteServers[ServerListView.SelectedRow]; ServerListStore.RemoveRow(ServerListView.SelectedRow); UserSettings.Local.FavoriteServers = UserSettings.Local.FavoriteServers.Where( s => s.Name != server.Name && s.Address != server.Address).ToArray(); UserSettings.Local.Save(); }; CommitAddNewServer.Clicked += (sender, e) => { var server = new FavoriteServer { Name = NewServerName.Text, Address = NewServerAddress.Text }; var row = ServerListStore.AddRow(); using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("TrueCraft.Launcher.Content.default-server-icon.png")) ServerListStore.SetValue(row, iconField, Image.FromStream(stream)); ServerListStore.SetValue(row, nameField, server.Name); ServerListStore.SetValue(row, playersField, "TODO/50"); UserSettings.Local.FavoriteServers = UserSettings.Local.FavoriteServers.Concat(new[] { server }).ToArray(); UserSettings.Local.Save(); AddServerButton.Sensitive = true; RemoveServerButton.Sensitive = true; ConnectButton.Sensitive = true; ServerListView.Sensitive = true; ServerIPEntry.Sensitive = true; ServerCreationBox.Visible = false; }; foreach (var server in UserSettings.Local.FavoriteServers) { var row = ServerListStore.AddRow(); using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("TrueCraft.Launcher.Content.default-server-icon.png")) ServerListStore.SetValue(row, iconField, Image.FromStream(stream)); ServerListStore.SetValue(row, nameField, server.Name); ServerListStore.SetValue(row, playersField, "TODO/50"); } var addServerHBox = new HBox(); AddServerButton.WidthRequest = RemoveServerButton.WidthRequest = 0.5; addServerHBox.PackStart(AddServerButton, true); addServerHBox.PackStart(RemoveServerButton, true); var commitHBox = new HBox(); CancelAddNewServer.WidthRequest = CommitAddNewServer.WidthRequest = 0.5; commitHBox.PackStart(CommitAddNewServer, true); commitHBox.PackStart(CancelAddNewServer, true); ServerCreationBox.PackStart(NewServerLabel); ServerCreationBox.PackStart(NewServerName); ServerCreationBox.PackStart(NewServerAddress); ServerCreationBox.PackStart(commitHBox); this.PackEnd(BackButton); this.PackEnd(ConnectButton); this.PackStart(MultiplayerLabel); this.PackStart(ServerIPEntry); this.PackStart(ServerListView); this.PackStart(addServerHBox); this.PackStart(ServerCreationBox); }
public SingleplayerView(LauncherWindow window) { Worlds.Local = new Worlds(); Worlds.Local.Load(); Window = window; this.MinWidth = 250; SingleplayerLabel = new Label("Singleplayer") { Font = Font.WithSize(16), TextAlignment = Alignment.Center }; WorldListView = new ListView { MinHeight = 200, SelectionMode = SelectionMode.Single }; CreateWorldButton = new Button("New world"); DeleteWorldButton = new Button("Delete") { Sensitive = false }; PlayButton = new Button("Play") { Sensitive = false }; BackButton = new Button("Back"); CreateWorldBox = new VBox() { Visible = false }; NewWorldName = new TextEntry() { PlaceholderText = "Name" }; NewWorldSeed = new TextEntry() { PlaceholderText = "Seed (optional)" }; NewWorldCommit = new Button("Create") { Sensitive = false }; NewWorldCancel = new Button("Cancel"); NameField = new DataField<string>(); WorldListStore = new ListStore(NameField); WorldListView.DataSource = WorldListStore; WorldListView.HeadersVisible = false; WorldListView.Columns.Add(new ListViewColumn("Name", new TextCellView { TextField = NameField, Editable = false })); ProgressLabel = new Label("Loading world...") { Visible = false }; ProgressBar = new ProgressBar() { Visible = false, Indeterminate = true, Fraction = 0 }; BackButton.Clicked += (sender, e) => { Window.MainContainer.Remove(this); Window.MainContainer.PackEnd(Window.MainMenuView); }; CreateWorldButton.Clicked += (sender, e) => { CreateWorldBox.Visible = true; }; NewWorldCancel.Clicked += (sender, e) => { CreateWorldBox.Visible = false; }; NewWorldName.Changed += (sender, e) => { NewWorldCommit.Sensitive = !string.IsNullOrEmpty(NewWorldName.Text); }; NewWorldCommit.Clicked += NewWorldCommit_Clicked; WorldListView.SelectionChanged += (sender, e) => { PlayButton.Sensitive = DeleteWorldButton.Sensitive = WorldListView.SelectedRow != -1; }; PlayButton.Clicked += PlayButton_Clicked; DeleteWorldButton.Clicked += (sender, e) => { var world = Worlds.Local.Saves[WorldListView.SelectedRow]; WorldListStore.RemoveRow(WorldListView.SelectedRow); Worlds.Local.Saves = Worlds.Local.Saves.Where(s => s != world).ToArray(); Directory.Delete(world.BaseDirectory, true); }; foreach (var world in Worlds.Local.Saves) { var row = WorldListStore.AddRow(); WorldListStore.SetValue(row, NameField, world.Name); } var createDeleteHbox = new HBox(); CreateWorldButton.WidthRequest = DeleteWorldButton.WidthRequest = 0.5; createDeleteHbox.PackStart(CreateWorldButton, true); createDeleteHbox.PackStart(DeleteWorldButton, true); CreateWorldBox.PackStart(NewWorldName); CreateWorldBox.PackStart(NewWorldSeed); var newWorldHbox = new HBox(); NewWorldCommit.WidthRequest = NewWorldCancel.WidthRequest = 0.5; newWorldHbox.PackStart(NewWorldCommit, true); newWorldHbox.PackStart(NewWorldCancel, true); CreateWorldBox.PackStart(newWorldHbox); this.PackStart(SingleplayerLabel); this.PackStart(WorldListView); this.PackStart(createDeleteHbox); this.PackStart(PlayButton); this.PackStart(CreateWorldBox); this.PackStart(ProgressLabel); this.PackStart(ProgressBar); this.PackEnd(BackButton); }
public ListView1() { PackStart(new Label("The listview should have a red background")); ListView list = new ListView(); list.BackgroundColor = Colors.Red; list.GridLinesVisible = GridLines.Both; ListStore store = new ListStore(name, icon, text, icon2, progress); list.DataSource = store; list.Columns.Add("Name", icon, name); list.Columns.Add("Text", icon2, text); list.Columns.Add("Progress", new TextCellView() { TextField = text }, new CustomCell() { ValueField = progress }); var png = Image.FromResource(typeof(App), "class.png"); Random rand = new Random(); for (int n = 0; n < 100; n++) { var r = store.AddRow(); store.SetValue(r, icon, png); store.SetValue(r, name, "Value " + n); store.SetValue(r, icon2, png); store.SetValue(r, text, "Text " + n); store.SetValue(r, progress, new CellData { Value = rand.Next() % 100 }); } PackStart(list, true); list.RowActivated += delegate(object sender, ListViewRowEventArgs e) { MessageDialog.ShowMessage("Row " + e.RowIndex + " activated"); }; Menu contextMenu = new Menu(); contextMenu.Items.Add(new MenuItem("Test menu")); list.ButtonPressed += delegate(object sender, ButtonEventArgs e) { int row = list.GetRowAtPosition(new Point(e.X, e.Y)); if (e.Button == PointerButton.Right && row >= 0) { // Set actual row to selected list.SelectRow(row); contextMenu.Popup(list, e.X, e.Y); } }; list.KeyPressed += (sender, e) => { if (e.Key == Key.Insert) { var r = store.InsertRowAfter(list.SelectedRow < 0 ? 0 : list.SelectedRow); store.SetValue(r, icon, png); store.SetValue(r, name, "Value " + (store.RowCount + 1)); store.SetValue(r, icon2, png); store.SetValue(r, text, "New Text " + (store.RowCount + 1)); store.SetValue(r, progress, new CellData { Value = rand.Next() % 100 }); list.ScrollToRow(r); list.SelectRow(r); list.FocusedRow = r; } }; HBox btnBox = new HBox(); Button btnAddItem = new Button("Add item"); btnAddItem.Clicked += delegate { var r = store.InsertRowAfter(list.SelectedRow < 0 ? 0 : list.SelectedRow); store.SetValue(r, icon, png); store.SetValue(r, name, "Value " + (store.RowCount + 1)); store.SetValue(r, icon2, png); store.SetValue(r, text, "New Text " + (store.RowCount + 1)); store.SetValue(r, progress, new CellData { Value = rand.Next() % 100 }); list.ScrollToRow(r); list.SelectRow(r); }; btnBox.PackStart(btnAddItem, true); Button btnRemoveItem = new Button("Remove item"); btnRemoveItem.Clicked += delegate { if (list.SelectedRow >= 0) { store.RemoveRow(list.SelectedRow); } }; btnBox.PackStart(btnRemoveItem, true); PackStart(btnBox); var but = new Button("Scroll one line"); but.Clicked += delegate { list.VerticalScrollControl.Value += list.VerticalScrollControl.StepIncrement; }; PackStart(but); var spnValue = new SpinButton(); spnValue.MinimumValue = 0; spnValue.MaximumValue = 99; spnValue.IncrementValue = 1; spnValue.Digits = 0; var btnScroll = new Button("Go!"); btnScroll.Clicked += (sender, e) => list.ScrollToRow((int)spnValue.Value); HBox scrollActBox = new HBox(); scrollActBox.PackStart(new Label("Scroll to Value: ")); scrollActBox.PackStart(spnValue); scrollActBox.PackStart(btnScroll); PackStart(scrollActBox); }
public MultiplayerView(LauncherWindow window) { Window = window; this.MinWidth = 250; MultiplayerLabel = new Label("Multiplayer") { Font = Font.WithSize(16), TextAlignment = Alignment.Center }; ServerIPEntry = new TextEntry() { PlaceholderText = "Server IP", Text = UserSettings.Local.LastIP }; ConnectButton = new Button("Connect"); BackButton = new Button("Back"); ServerListView = new ListView() { MinHeight = 200, SelectionMode = SelectionMode.Single }; AddServerButton = new Button("Add server"); RemoveServerButton = new Button("Remove") { Sensitive = false }; ServerCreationBox = new VBox() { Visible = false }; NewServerLabel = new Label("Add new server:") { TextAlignment = Alignment.Center }; NewServerName = new TextEntry() { PlaceholderText = "Name" }; NewServerAddress = new TextEntry() { PlaceholderText = "Address" }; CommitAddNewServer = new Button("Add server"); CancelAddNewServer = new Button("Cancel"); var iconField = new DataField<Image>(); var nameField = new DataField<string>(); var playersField = new DataField<string>(); ServerListStore = new ListStore(iconField, nameField, playersField); ServerListView.DataSource = ServerListStore; ServerListView.HeadersVisible = false; ServerListView.Columns.Add(new ListViewColumn("Icon", new ImageCellView { ImageField = iconField })); ServerListView.Columns.Add(new ListViewColumn("Name", new TextCellView { TextField = nameField })); ServerListView.Columns.Add(new ListViewColumn("Players", new TextCellView { TextField = playersField })); ServerIPEntry.KeyReleased += (sender, e) => { if (e.Key == Key.Return || e.Key == Key.NumPadEnter) ConnectButton_Clicked(sender, e); }; BackButton.Clicked += (sender, e) => { Window.InteractionBox.Remove(this); Window.InteractionBox.PackEnd(Window.MainMenuView); }; ConnectButton.Clicked += ConnectButton_Clicked; ServerListView.SelectionChanged += (sender, e) => { RemoveServerButton.Sensitive = ServerListView.SelectedRow != -1; ServerIPEntry.Sensitive = ServerListView.SelectedRow == -1; }; AddServerButton.Clicked += (sender, e) => { AddServerButton.Sensitive = false; RemoveServerButton.Sensitive = false; ConnectButton.Sensitive = false; ServerListView.Sensitive = false; ServerIPEntry.Sensitive = false; ServerCreationBox.Visible = true; }; CancelAddNewServer.Clicked += (sender, e) => { AddServerButton.Sensitive = true; RemoveServerButton.Sensitive = true; ConnectButton.Sensitive = true; ServerListView.Sensitive = true; ServerIPEntry.Sensitive = true; ServerCreationBox.Visible = false; }; RemoveServerButton.Clicked += (sender, e) => { var server = UserSettings.Local.FavoriteServers[ServerListView.SelectedRow]; ServerListStore.RemoveRow(ServerListView.SelectedRow); UserSettings.Local.FavoriteServers = UserSettings.Local.FavoriteServers.Where( s => s.Name != server.Name && s.Address != server.Address).ToArray(); UserSettings.Local.Save(); }; CommitAddNewServer.Clicked += (sender, e) => { var server = new FavoriteServer { Name = NewServerName.Text, Address = NewServerAddress.Text }; var row = ServerListStore.AddRow(); using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("TrueCraft.Launcher.Content.default-server-icon.png")) ServerListStore.SetValue(row, iconField, Image.FromStream(stream)); ServerListStore.SetValue(row, nameField, server.Name); ServerListStore.SetValue(row, playersField, "TODO/50"); UserSettings.Local.FavoriteServers = UserSettings.Local.FavoriteServers.Concat(new[] { server }).ToArray(); UserSettings.Local.Save(); AddServerButton.Sensitive = true; RemoveServerButton.Sensitive = true; ConnectButton.Sensitive = true; ServerListView.Sensitive = true; ServerIPEntry.Sensitive = true; ServerCreationBox.Visible = false; }; foreach (var server in UserSettings.Local.FavoriteServers) { var row = ServerListStore.AddRow(); using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("TrueCraft.Launcher.Content.default-server-icon.png")) ServerListStore.SetValue(row, iconField, Image.FromStream(stream)); ServerListStore.SetValue(row, nameField, server.Name); ServerListStore.SetValue(row, playersField, "TODO/50"); } var addServerHBox = new HBox(); AddServerButton.WidthRequest = RemoveServerButton.WidthRequest = 0.5; addServerHBox.PackStart(AddServerButton, true); addServerHBox.PackStart(RemoveServerButton, true); var commitHBox = new HBox(); CancelAddNewServer.WidthRequest = CommitAddNewServer.WidthRequest = 0.5; commitHBox.PackStart(CommitAddNewServer, true); commitHBox.PackStart(CancelAddNewServer, true); ServerCreationBox.PackStart(NewServerLabel); ServerCreationBox.PackStart(NewServerName); ServerCreationBox.PackStart(NewServerAddress); ServerCreationBox.PackStart(commitHBox); this.PackEnd(BackButton); this.PackEnd(ConnectButton); this.PackStart(MultiplayerLabel); this.PackStart(ServerIPEntry); this.PackStart(ServerListView); this.PackStart(addServerHBox); this.PackStart(ServerCreationBox); }
private void RemoveDevice(int index) { deviceListStoreMirror.RemoveAt(index); deviceListStore.RemoveRow(index); }
public ListView1 () { PackStart (new Label ("The listview should have a red background")); ListView list = new ListView (); list.BackgroundColor = Colors.Red; list.GridLinesVisible = GridLines.Both; ListStore store = new ListStore (name, icon, text, icon2, progress); list.DataSource = store; list.Columns.Add ("Name", icon, name); list.Columns.Add ("Text", icon2, text); list.Columns.Add ("Progress", new TextCellView () { TextField = text }, new CustomCell () { ValueField = progress }); var png = Image.FromResource (typeof(App), "class.png"); Random rand = new Random (); for (int n=0; n<100; n++) { var r = store.AddRow (); store.SetValue (r, icon, png); store.SetValue (r, name, "Value " + n); store.SetValue (r, icon2, png); store.SetValue (r, text, "Text " + n); store.SetValue (r, progress, new CellData { Value = rand.Next () % 100 }); } PackStart (list, true); list.RowActivated += delegate(object sender, ListViewRowEventArgs e) { MessageDialog.ShowMessage ("Row " + e.RowIndex + " activated"); }; Menu contextMenu = new Menu (); contextMenu.Items.Add (new MenuItem ("Test menu")); list.ButtonPressed += delegate(object sender, ButtonEventArgs e) { int row = list.GetRowAtPosition(new Point(e.X, e.Y)); if (e.Button == PointerButton.Right && row >= 0) { // Set actual row to selected list.SelectRow(row); contextMenu.Popup(list, e.X, e.Y); } }; list.KeyPressed += (sender, e) => { if (e.Key == Key.Insert) { var r = store.InsertRowAfter(list.SelectedRow < 0 ? 0 : list.SelectedRow); store.SetValue (r, icon, png); store.SetValue (r, name, "Value " + (store.RowCount + 1)); store.SetValue (r, icon2, png); store.SetValue (r, text, "New Text " + (store.RowCount + 1)); store.SetValue (r, progress, new CellData { Value = rand.Next () % 100 }); list.ScrollToRow (r); list.SelectRow (r); list.FocusedRow = r; } }; HBox btnBox = new HBox (); Button btnAddItem = new Button ("Add item"); btnAddItem.Clicked += delegate { var r = store.InsertRowAfter(list.SelectedRow < 0 ? 0 : list.SelectedRow); store.SetValue (r, icon, png); store.SetValue (r, name, "Value " + (store.RowCount + 1)); store.SetValue (r, icon2, png); store.SetValue (r, text, "New Text " + (store.RowCount + 1)); store.SetValue (r, progress, new CellData { Value = rand.Next () % 100 }); list.ScrollToRow (r); list.SelectRow (r); }; btnBox.PackStart (btnAddItem, true); Button btnRemoveItem = new Button ("Remove item"); btnRemoveItem.Clicked += delegate { if (list.SelectedRow >= 0) store.RemoveRow(list.SelectedRow); }; btnBox.PackStart (btnRemoveItem, true); PackStart (btnBox); var but = new Button ("Scroll one line"); but.Clicked += delegate { list.VerticalScrollControl.Value += list.VerticalScrollControl.StepIncrement; }; PackStart (but); var spnValue = new SpinButton (); spnValue.MinimumValue = 0; spnValue.MaximumValue = 99; spnValue.IncrementValue = 1; spnValue.Digits = 0; var btnScroll = new Button ("Go!"); btnScroll.Clicked += (sender, e) => list.ScrollToRow((int)spnValue.Value); HBox scrollActBox = new HBox (); scrollActBox.PackStart (new Label("Scroll to Value: ")); scrollActBox.PackStart (spnValue); scrollActBox.PackStart (btnScroll); PackStart (scrollActBox); }