前言:
当前使用的是6.25,随着学习的积累不断更新
问题部分
grid
group的时候如果是数值类型,如何实现按值的区域分组
TreeList
绑定模式时,如何显示根节点的column?
公共工具部分
Repository:
有两种Repository,即internal repository和external repository。二者的区别在于,能被控件使用的个数上(internal repository只能用在一个控件上,而external repository可以用在多个控件里)。也就是说internal 和external是相对于某一个控件而言的。
要在多个控件内使用,则需持久化在控件外部,这是要用到PersistentRepository。下面是doc自带的示例:
//Add a repository item corresponding to a combo box editor to the persistent repository
RepositoryItemComboBox riCombo = new RepositoryItemComboBox();
riCombo.Items.AddRange(new string[] {"Cash", "Visa", "Master", "Am.Express" });
persistentRepository1.Items.Add(riCombo);
//Link the persistent repository to two grid controls
gridControl1.ExternalRepository = persistentRepository1;
gridControl2.ExternalRepository = persistentRepository1;
//Now you can define the repository item as an inplace editor of columns for the two grids
(gridControl1.MainView as GridView).Columns["PaymentType"].ColumnEdit = riCombo;
(gridControl2.MainView as GridView).Columns["PaymentType"].ColumnEdit = riCombo;
控件部分
Grid:
Grid views support the grouping feature, which means that some data rows can be hidden within collapsed groups. In such views, the BaseView.RowCount property value identifies the number of non-hidden rows,也就是说RowCount所指的行数不是数据源中的实际行数,而是在grid控件中显示的行数。
Note that in MultiSelect, the focused row is not always selected. The array of selected row handles, that is returned by the ColumnView.GetSelectedRows method, may not contain the focused row handle, which is identified by the ColumnView.FocusedRowHandle property.
也就是说select和focuse并不是一回事。
当启用SelectionChanged事件时,若要选择多个选项而不想每次都触发SelectionChanged事件,可以通过BaseView.BeginSelection/BaseView.EndSelection来实现。
Editor:
ComboBoxEditor
实现DropDownList模式:在Properties下将TextEditStyle改为DisableEditor