/// <summary> /// Initializes a new <see cref="GridCellRendererBase"/> object for the given GridControlBase /// and <see cref="GridCellModelBase"/>. /// </summary> /// <param name="grid">The <see cref="GridControlBase"/> that display this cell renderer.</param> /// <param name="cellModel">The <see cref="GridCellModelBase"/> that holds data for this cell renderer that should /// be shared among views.</param> /// <remarks>References to GridControlBase, /// and GridCellModelBase will be saved.</remarks> public GridDataBoundTreeCellRenderer(GridControlBase grid, GridCellModelBase cellModel, TreeGridHelper helper) : base(grid, cellModel) { AddButton(new GridDataBoundTreeCellButton(this, helper)); lineColor = Color.Black; this.treeHelper = helper; }
//Manually specifing self relations in a table. private void SelfReferenceForm_Load(object sender, System.EventArgs e) { DataSet ds = new DataSet(); String commandstring = "select DEPTNO,ID,MGR,DEPTNAME,LOCATION,ADMRDEBT from DEPT"; SqlCeDataAdapter da = new SqlCeDataAdapter(commandstring, connString); try { da.Fill(ds, "DEPT"); } catch (SqlException ex) { ShowErrorMessage(ex); } DataTable flatTable = ds.Tables[0]; //set the datasource as a flat datatable this.gridGroupingControl1.DataSource = flatTable; //make it so cell does not become active when clicked this.gridGroupingControl1.TableModel.Options.ActivateCurrentCellBehavior = GridCellActivateAction.None; //set the row selection mode this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended; this.gridGroupingControl1.TableOptions.ListBoxSelectionCurrentCellOptions = GridListBoxSelectionCurrentCellOptions.HideCurrentCell; //hide the row headers this.gridGroupingControl1.TableOptions.ShowRowHeader = false; this.gridGroupingControl1.TableDescriptor.VisibleColumns.RemoveAt(2); this.gridGroupingControl1.TableDescriptor.Columns["ID"].HeaderText = "DEPT. ID"; this.gridGroupingControl1.TableDescriptor.Columns["ADMRDEBT"].HeaderText = "HEADER DEPT. ID"; this.gridGroupingControl1.TableDescriptor.Columns["DEPTNO"].HeaderText = "DEPT CODE"; this.gridGroupingControl1.TableDescriptor.Columns["DEPTNAME"].HeaderText = "DEPT. NAME"; //create the treeGridHelper and wire the grid to it... this.treeGrid = new TreeGridHelper.TreeGridHelper(); this.treeGrid.ColorCodeSiblings = false;//dont show colors //wiring GridGroupingControl with treeGrid. this.accessor = this.treeGrid.WireSelfReferenceGrid(this.gridGroupingControl1, flatTable, "ADMRDEBT", "ID", "DEPTNO"); //allow editing type properties treeGrid.ExpandAll(); radioButton1.Select(); }
/// <summary> /// Initializes a <see cref="GridDataBoundTreeCellButton"/> and associates it with a <see cref="GridCellRendererBase"/> /// </summary> /// <param name="control">The <see cref="GridCellRendererBase"/> that draws this cell button element.</param> public GridDataBoundTreeCellButton(GridCellRendererBase control, TreeGridHelper helper) : base(control) { this.helper = helper; iconPainter = new GridIconPaint("TreeGridHelper.", typeof(GridDataBoundTreeCellButton).Assembly); }
/// <summary> /// Initializes a new <see cref="GridDataBoundTreeCellModel"/> object /// and stores a reference to the <see cref="GridModel"/> this cell belongs to. /// </summary> /// <param name="grid">The <see cref="GridModel"/> for this cell model.</param> /// <remarks> /// You typically access cell models through the <see cref="GridModel.CellModels"/> /// property of the <see cref="GridModel"/> class. /// </remarks> public GridDataBoundTreeCellModel(GridModel grid, TreeGridHelper helper) : base(grid) { this.helper = helper; }