private void ResetDataInTreeView() { c1TreeView1.Columns.Clear(); c1TreeView1.BindingInfo.DataSource = null; c1TreeView1.BindingInfo.DataMember = "\\ProductsGroups\\Products"; var column = new C1TreeColumn(); column.HeaderText = "Name"; c1TreeView1.Columns.Add(column); column = new C1TreeColumn(); column.DisplayFieldName = "CountOfProducts"; column.HeaderText = "Products in store"; column.AutoWidth = false; column.Width = 100; c1TreeView1.Columns.Add(column); column = new C1TreeColumn(); column.DisplayFieldName = "\\\\Price"; column.HeaderText = "Price"; column.Width = 200; c1TreeView1.Columns.Add(column); c1TreeView1.BindingInfo.DataSource = StoreCollection.GetData(); c1TreeView1.Nodes[0].Images.Add(0); c1TreeView1.Nodes[1].Images.Add(1); c1TreeView1.Nodes[2].Images.Add(2); }
private void Initialize() { c1Ribbon1.SelectedTabIndex = 1; foreach (var theme in C1ThemeController.GetThemes()) { ribbonCmbThemes.Items.Add(theme); } // init TreeView c1TreeView1.Columns.Clear(); c1TreeView1.DataSource = null; c1TreeView1.DataMember = "\\ProductsGroups\\Products"; var column = new C1TreeColumn { HeaderText = "Name" }; c1TreeView1.Columns.Add(column); column = new C1TreeColumn { DisplayFieldName = "\\\\Count", HeaderText = "Count", Width = 100 }; c1TreeView1.Columns.Add(column); column = new C1TreeColumn { DisplayFieldName = "\\\\Price", HeaderText = "Price", Width = 200 }; c1TreeView1.Columns.Add(column); c1TreeView1.DataSource = StoreCollection.GetData(); c1TreeView1.ExpandAll(); // init ExpressionEditor c1ExpressionEditor1.IntelliAutoCompletionEnabled = false; var ce = new ExpressionEditorCustomEngine.CustomEngine(); var cl = new CustomLexer(); c1ExpressionEditor1.SetCustomEngine(ce, cl); c1ExpressionEditor1.DataSource = c1TreeView1.DataSource; c1ExpressionEditor1.Expression = "[ProductsGroups].Where(x => x.Name == \"Notebooks\").Sum(x => x.Products.Sum(p => p.Count))"; var p = new CustomPresenter(); CustomPresenter.Editor = c1ExpressionEditor1; c1TreeView1.Columns[1].CustomContentPresenter = p; }