'宣言 Public Enum FieldAutoSizeScope Inherits System.Enum
public enum FieldAutoSizeScope : System.Enum
メンバ | 解説 |
---|---|
AllRecords | すべてのレコードが計算に含まれます。このオプションは、自動サイズ変更操作を実行するときに、レコードを割り当てます。 |
Default | デフォルトでは、表示されているレコードのみに影響があります。 |
RecordsInView | 表示されているレコードのみに影響があります。 |
ViewableRecords | エンドユーザーに表示される可能性のあるすべてのレコード。例えば、縮小されたレコードの子および非表示にされているレコードは無視されます。このオプションは、自動サイズ変更操作を実行するときにレコードを割り当てます。 |
Imports Infragistics.Windows.DataPresenter Private Sub xamDataGrid1_Initialized(ByVal sender As System.Object, ByVal e As System.EventArgs) Me.InitializeControl(DirectCast(sender, XamDataGrid)) End Sub Private Sub InitializeControl(ByVal grid As XamDataGrid) Dim fl As New FieldLayout() ' As with other properties on FieldSettings you can set ' properties for a specific field layout that apply to ' all fields in that field layout. Dim flSettings As New FieldSettings() ' In this case, when autosizing we want to take into account ' all records whether they are visible or not, in view or ' not. Note, this adds overhead from a memory perspective ' since all records must be loaded and from a processing ' perspective since measuring the elements can take time ' so you should use the default RecordsInView option when ' possible especially when you have more than a small ' # of records. ' flSettings.AutoSizeScope = FieldAutoSizeScope.AllRecords ' The AutoSizeOptions indicates the types of elements that ' you want to measure. In this case we will default to auto ' sizing to the label and data cells only (ignoring filter ' cells and summaries). Usually this will be left to the ' default value of All. flSettings.AutoSizeOptions = FieldAutoSizeOptions.Label Or FieldAutoSizeOptions.DataCells fl.FieldSettings = flSettings ' Auto indicates that the size of the field should grow as ' larger data is encountered (scrolling, adding records, ' editing cell data, etc.). Dim fEmail As New Field() fEmail.Name = "email" fEmail.Width = FieldLength.Auto ' You can set the properties on a per field basis. For this ' field since each record has a unique value and therefore ' we could have lots of different values to measure, we'll ' just auto size to what's in view. Dim fs As New FieldSettings() fs.AutoSizeScope = FieldAutoSizeScope.RecordsInView fEmail.Settings = fs fl.Fields.Add(fEmail) ' InitialAuto indicates that the size of the field should be ' based upon the initial content when the field layout is ' first used. Dim fDept As New Field() fDept.Name = "department" fDept.Width = FieldLength.InitialAuto ' The AutoSizeOptions and Scope are used to determine what to ' measure initially as well as when the user double clicks on ' the field edge. fs = New FieldSettings() fs.AutoSizeScope = FieldAutoSizeScope.AllRecords fs.AutoSizeOptions = FieldAutoSizeOptions.All fDept.Settings = fs fl.Fields.Add(fDept) ' explicit logical pixel width Dim fName As New Field() fName.Name = "name" fName.Width = New FieldLength(150) ' The AutoSizeOptions and AutoSizeScope affect fields that are ' not explicitly autosized as well. They are used to determine ' what is measured when the end-user double clicks on the far ' edge of a field label/cell. fs = New FieldSettings() fs.AutoSizeScope = FieldAutoSizeScope.RecordsInView fName.Settings = fs fl.Fields.Add(fName) Dim uf1 As New UnboundField() uf1.Name = "IsActive" uf1.Width = FieldLength.InitialAuto uf1.DataType = GetType(Boolean) ' If you do use an AutoSizeScope of AllRecords, you still may ' want to set this to RecordsInView for fields where the extent ' of the data doesn't change based on the value (e.g. a ' checkbox field). fs = New FieldSettings() fs.AutoSizeScope = FieldAutoSizeScope.RecordsInView fs.AutoSizeOptions = FieldAutoSizeOptions.All uf1.Settings = fs fl.Fields.Add(uf1) ' add the new field layout we define to the datapresenter grid.FieldLayouts.Add(fl) End Sub
using Infragistics.Windows.DataPresenter; private void xamDataGrid1_Initialized(object sender, EventArgs e) { this.InitializeControl(sender as XamDataGrid); } private void InitializeControl(XamDataGrid grid) { FieldLayout fl = new FieldLayout(); // As with other properties on FieldSettings you can set // properties for a specific field layout that apply to // all fields in that field layout. FieldSettings flSettings = new FieldSettings(); // In this case, when autosizing we want to take into account // all records whether they are visible or not, in view or // not. Note, this adds overhead from a memory perspective // since all records must be loaded and from a processing // perspective since measuring the elements can take time // so you should use the default RecordsInView option when // possible especially when you have more than a small // # of records. // flSettings.AutoSizeScope = FieldAutoSizeScope.AllRecords; // The AutoSizeOptions indicates the types of elements that // you want to measure. In this case we will default to auto // sizing to the label and data cells only (ignoring filter // cells and summaries). Usually this will be left to the // default value of All. flSettings.AutoSizeOptions = FieldAutoSizeOptions.Label | FieldAutoSizeOptions.DataCells; fl.FieldSettings = flSettings; // Auto indicates that the size of the field should grow as // larger data is encountered (scrolling, adding records, // editing cell data, etc.). Field fEmail = new Field(); fEmail.Name = "email"; fEmail.Width = FieldLength.Auto; // You can set the properties on a per field basis. For this // field since each record has a unique value and therefore // we could have lots of different values to measure, we'll // just auto size to what's in view. FieldSettings fs = new FieldSettings(); fs.AutoSizeScope = FieldAutoSizeScope.RecordsInView; fEmail.Settings = fs; fl.Fields.Add(fEmail); // InitialAuto indicates that the size of the field should be // based upon the initial content when the field layout is // first used. Field fDept = new Field(); fDept.Name = "department"; fDept.Width = FieldLength.InitialAuto; // The AutoSizeOptions and Scope are used to determine what to // measure initially as well as when the user double clicks on // the field edge. fs = new FieldSettings(); fs.AutoSizeScope = FieldAutoSizeScope.AllRecords; fs.AutoSizeOptions = FieldAutoSizeOptions.All; fDept.Settings = fs; fl.Fields.Add(fDept); // explicit logical pixel width Field fName = new Field(); fName.Name = "name"; fName.Width = new FieldLength(150); // The AutoSizeOptions and AutoSizeScope affect fields that are // not explicitly autosized as well. They are used to determine // what is measured when the end-user double clicks on the far // edge of a field label/cell. fs = new FieldSettings(); fs.AutoSizeScope = FieldAutoSizeScope.RecordsInView; fName.Settings = fs; fl.Fields.Add(fName); UnboundField uf1 = new UnboundField(); uf1.Name = "IsActive"; uf1.Width = FieldLength.InitialAuto; uf1.DataType = typeof(bool); // If you do use an AutoSizeScope of AllRecords, you still may // want to set this to RecordsInView for fields where the extent // of the data doesn't change based on the value (e.g. a // checkbox field). fs = new FieldSettings(); fs.AutoSizeScope = FieldAutoSizeScope.RecordsInView; fs.AutoSizeOptions = FieldAutoSizeOptions.All; uf1.Settings = fs; fl.Fields.Add(uf1); // add the new field layout we define to the datapresenter grid.FieldLayouts.Add(fl); }