//Populate Category treeview public void PopulateCategories() { // Query for the user categories. These are the values // for the nodes. DataSet ResultSet = new DataSet(); DatabaseHelper.manupulateCategory(1).Fill(ResultSet, "Categories"); CategoryTreeView.Nodes[0].Nodes.Clear(); // Create the second-level nodes. if (ResultSet.Tables.Count > 0) { // Iterate through and create a new node for each row in the query results. // Notice that the query results are stored in the table of the DataSet. foreach (DataRow row in ResultSet.Tables[0].Rows) { //MessageBox.Show(row["CategoryName"].ToString()); // Create the new node. Notice that the CategoryId is stored in the Value property // of the node. This will make querying for items in a specific category easier when // the third-level nodes are created. TreeNode NewNode = new TreeNode(row["CategoryName"].ToString()); //Save the CategoryID to the treeNode value NewNode.Tag = row["CategoryID"]; // Add the new node to the ChildNodes collection of the parent node. Node[0] is the parent Node. CategoryTreeView.Nodes[0].Nodes.Add(NewNode); //MessageBox.Show(row["CategoryName"].ToString() + "is created."); //CategoryTreeView.ExpandAll(); } } CategoryTreeView.Update(); }
void InitializeComponent() { DefaultSize = new Gdk.Size(900, 500); var mainVbox = new VBox(false, 0); MainMenubar = new MenuBar(); InitMenu(MainMenubar); MainToolbar = new Toolbar(); InitToolbar(MainToolbar); var splitCont = new HPaned(); // list of downloads downloadList = new DownloadList(); var scrolledWindow = new ScrolledWindow(); scrolledWindow.Child = downloadList; splitCont.Add2(scrolledWindow); nodeModel = downloadList.Model; // categories list catList = new CategoryTreeView(); splitCont.Add1(catList); catList.Selection.Changed += CategorySelectionOnChanged; mainVbox.PackStart(MainMenubar, false, true, 0); mainVbox.PackStart(MainToolbar, false, false, 0); mainVbox.PackStart(splitCont); Add(mainVbox); ShowAll(); }
/// <summary> /// Скрыть все ветви. /// </summary> private void HideCategoryBtn_Click(object sender, EventArgs e) { CategoryTreeView.CollapseAll(); HideCategoryBtn.Visible = false; ShowAllCategoryBtn.Visible = true; }
/// <summary> /// Раскрыть все ветви. /// </summary> private void ShowAllCategoryBtn_Click(object sender, EventArgs e) { CategoryTreeView.ExpandAll(); ShowAllCategoryBtn.Visible = false; HideCategoryBtn.Visible = true; }
private void viewModel_SearchTextChanged(object sender, EventArgs e) { //Get the scrollview and scroll to top on every text entered var scroll = CategoryTreeView.ChildOfType <ScrollViewer>(); if (scroll != null) { scroll.ScrollToTop(); } }
private TreeNodeContent ConvertToNode(CategoryTreeView category) { var node = new TreeNodeContent(Constants.DataProvider.NodeType.ProductCategory, category.CategoryId) { Name = category.Name, ItemGuid = category.Guid, SortOrder = category.SortOrder }; return(node); }
private void BindData() { cbShowCategoriesOnMainPage.Checked = SettingManager.GetSettingValueBoolean("Display.ShowCategoriesOnMainPage"); string menu = GetCategories(0); string categoryAddURL = CommonHelper.GetStoreAdminLocation() + "CategoryAdd.aspx"; menu = string.Format("<siteMapNode title=\"{0}\" url=\"{1}\">" + menu + "<siteMapNode title=\"{2} \" url=\"{3}\"></siteMapNode></siteMapNode>", GetLocaleResourceString("Admin.Categories.Categories"), string.Empty, GetLocaleResourceString("Admin.Categories.AddNewCategory"), categoryAddURL); ds.Data = menu; CategoryTreeView.DataBind(); }