using Gtk; public static void Main(string[] args) { // Create a new TreeStore with two columns TreeStore treeStore = new TreeStore(typeof(string), typeof(int)); // Append a new row to the TreeStore TreeIter iter; treeStore.AppendValues(out iter, "Item 1", 10); // Display the contents of the TreeStore while (treeStore.IterNext(ref iter)) { string name = (string)treeStore.GetValue(iter, 0); int value = (int)treeStore.GetValue(iter, 1); Console.WriteLine("{0}: {1}", name, value); } }
// Create a new TreeStore with three columns var treeStore = new TreeStore(typeof(string), typeof(bool), typeof(float)); // Append a new row to the TreeStore var iter = treeStore.AppendValues("Item 1", true, 2.5f); // Change the value of the third column treeStore.SetValue(iter, 2, 3.0f); // Check the value of the second column bool isChecked = (bool)treeStore.GetValue(iter, 1);In this example, a new TreeStore is created with three columns: one for strings, one for booleans, and one for floats. A new row is added to the TreeStore using the AppendValues method, and its contents are set to "Item 1", true, and 2.5f. The value of the third column is then changed to 3.0f using the SetValue method. Finally, the value of the second column is retrieved using the GetValue method. Package library: Gtk#