バージョン

AutoFitMode 列挙体

フィールドが DataPresenter の利用可能な領域のサイズに合うように常にサイズ変更されるかどうかを決定する列挙体。変更される場合は、どのフィールドをサイズ変更するかも決定します。
シンタックス
'宣言
 
Public Enum AutoFitMode 
   Inherits System.Enum
public enum AutoFitMode : System.Enum 
メンバ
メンバ解説
Alwaysフィールド レイアウトを常に AutoFit モードに設定すると、すべてのフィールドは自動でサイズ変更されます。
DefaultDataPresenterBase.AutoFit が true の場合はデフォルトで ResizeAllFields になり、DataPresenterBase.AutoFit が null の場合は ResizeStarFields、DataPresenterBase.AutoFit が false の場合は None になります。
ExtendLastField最後の論理列のフィールドのみがサイズ変更されます。例えば、垂直方向では、最も右のフィールドのサイズが変更されます。
Neverフィールドは、DataPresenterBase の表示可能領域に基づいて自動的にはサイズ変更されません。
OnlyWithVisibleStarFields明示的な star コンテンツを持つ 1 つの表示可能なフィールドがある場合、フィールド レイアウトで AutoFit モードを有効にします。
使用例
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 f As Field = Nothing

        ' You can control the default AutoFitMode for all FieldLayouts 
        ' that haven't explicitly set their AutoFitMode by either 
        ' setting it on the DP's FieldLayoutSettings. You can also 
        ' set the previously existing AutoFit property on the 
        ' DataPresenterBase.
        Dim flDefaultSettings As New FieldLayoutSettings()
        flDefaultSettings.AutoFitMode = AutoFitMode.Never
        flDefaultSettings.HeaderPrefixAreaDisplayMode = HeaderPrefixAreaDisplayMode.FieldChooserButton
        grid.FieldLayoutSettings = flDefaultSettings


        ' OnlyWithVisibleStarFields
        ' =========================

        ' AutoFitMode of OnlyWithVisibleStarFields so as long as there are 
        ' star fields visible, the fields will fill the available area.
        Dim flStar As New FieldLayout()
        flStar.Key = "HasStarFields"
        Dim flStarSettings As New FieldLayoutSettings()
        flStarSettings.AutoFitMode = AutoFitMode.OnlyWithVisibleStarFields
        flStar.Settings = flStarSettings

        f = New Field()
        f.Name = "name"
        flStar.Fields.Add(f)

        f = New Field()
        f.Name = "salary"
        flStar.Fields.Add(f)

        f = New Field()
        f.Name = "email"
        f.Width = New FieldLength(1, FieldLengthUnitType.Star)
        flStar.Fields.Add(f)

        f = New Field()
        f.Name = "department"
        f.Width = New FieldLength(2, FieldLengthUnitType.Star)
        flStar.Fields.Add(f)

        ' Always
        ' ======

        ' AutoFitMode of Always means all visible fields are resized to fill the 
        ' available area. The extent of fields may be increased or decreased.
        Dim flAlways As New FieldLayout()
        flAlways.Key = "Always"
        Dim flAlwaysSettings As New FieldLayoutSettings()
        flAlwaysSettings.AutoFitMode = AutoFitMode.Always
        flAlways.Settings = flAlwaysSettings

        f = New Field()
        f.Name = "name"
        flAlways.Fields.Add(f)

        f = New Field()
        f.Name = "salary"
        flAlways.Fields.Add(f)

        f = New Field()
        f.Name = "email"
        flAlways.Fields.Add(f)

        f = New Field()
        f.Name = "department"
        flAlways.Fields.Add(f)

        ' ExtendLastField
        ' ===============
        ' AutoFitMode of ExtendLastField is a little different than the 
        ' other modes in that non-star fields will never be reduced. The 
        ' preferred sizes of the fields is used and if there is extra 
        ' space available the last field will be increased in width to 
        ' fill the available area.
        Dim flExtend As New FieldLayout()
        flExtend.Key = "ExtendLastField"
        Dim flExtendSettings As New FieldLayoutSettings()
        flExtendSettings.AutoFitMode = AutoFitMode.ExtendLastField
        flExtend.Settings = flExtendSettings

        f = New Field()
        f.Name = "name"
        flExtend.Fields.Add(f)

        f = New Field()
        f.Name = "salary"
        flExtend.Fields.Add(f)

        f = New Field()
        f.Name = "email"
        flExtend.Fields.Add(f)

        f = New Field()
        f.Name = "department"
        flExtend.Fields.Add(f)

        ' Remove the key of one of these to use it in the sample
        ' e.g.
        'flStar.Key = Nothing

        grid.FieldLayouts.Add(flStar)
        grid.FieldLayouts.Add(flAlways)
        grid.FieldLayouts.Add(flExtend)
    End Sub
using Infragistics.Windows.DataPresenter;

	private void xamDataGrid1_Initialized(object sender, EventArgs e)
	{
		this.InitializeControl(sender as XamDataGrid);
	}

	private void InitializeControl(XamDataGrid grid)
	{
		Field f = null;

		// You can control the default AutoFitMode for all FieldLayouts 
		// that haven't explicitly set their AutoFitMode by either 
		// setting it on the DP's FieldLayoutSettings. You can also 
		// set the previously existing AutoFit property on the 
		// DataPresenterBase.
		FieldLayoutSettings flDefaultSettings = new FieldLayoutSettings();
		flDefaultSettings.AutoFitMode = AutoFitMode.Never;
		flDefaultSettings.HeaderPrefixAreaDisplayMode = HeaderPrefixAreaDisplayMode.FieldChooserButton;
		grid.FieldLayoutSettings = flDefaultSettings;


		// OnlyWithVisibleStarFields
		// =========================

		// AutoFitMode of OnlyWithVisibleStarFields so as long as there are 
		// star fields visible, the fields will fill the available area.
		FieldLayout flStar = new FieldLayout();
		flStar.Key = "HasStarFields";
		FieldLayoutSettings flStarSettings = new FieldLayoutSettings();
		flStarSettings.AutoFitMode = AutoFitMode.OnlyWithVisibleStarFields;
		flStar.Settings = flStarSettings;

		f = new Field();
		f.Name = "name";
		flStar.Fields.Add(f);

		f = new Field();
		f.Name = "salary";
		flStar.Fields.Add(f);

		f = new Field();
		f.Name = "email";
		f.Width = new FieldLength(1, FieldLengthUnitType.Star);
		flStar.Fields.Add(f);

		f = new Field();
		f.Name = "department";
		f.Width = new FieldLength(2, FieldLengthUnitType.Star);
		flStar.Fields.Add(f);

		// Always
		// ======

		// AutoFitMode of Always means all visible fields are resized to fill the 
		// available area. The extent of fields may be increased or decreased.
		FieldLayout flAlways = new FieldLayout();
		flAlways.Key = "Always";
		FieldLayoutSettings flAlwaysSettings = new FieldLayoutSettings();
		flAlwaysSettings.AutoFitMode = AutoFitMode.Always;
		flAlways.Settings = flAlwaysSettings;

		f = new Field();
		f.Name = "name";
		flAlways.Fields.Add(f);

		f = new Field();
		f.Name = "salary";
		flAlways.Fields.Add(f);

		f = new Field();
		f.Name = "email";
		flAlways.Fields.Add(f);

		f = new Field();
		f.Name = "department";
		flAlways.Fields.Add(f);

		// ExtendLastField
		// ===============
		// AutoFitMode of ExtendLastField is a little different than the 
		// other modes in that non-star fields will never be reduced. The 
		// preferred sizes of the fields is used and if there is extra 
		// space available the last field will be increased in width to 
		// fill the available area.
		FieldLayout flExtend = new FieldLayout();
		flExtend.Key = "ExtendLastField";
		FieldLayoutSettings flExtendSettings = new FieldLayoutSettings();
		flExtendSettings.AutoFitMode = AutoFitMode.ExtendLastField;
		flExtend.Settings = flExtendSettings;

		f = new Field();
		f.Name = "name";
		flExtend.Fields.Add(f);

		f = new Field();
		f.Name = "salary";
		flExtend.Fields.Add(f);

		f = new Field();
		f.Name = "email";
		flExtend.Fields.Add(f);

		f = new Field();
		f.Name = "department";
		flExtend.Fields.Add(f);

		// Remove the key of one of these to use it in the sample
		// e.g.
		//flExtend.Key = null;

		grid.FieldLayouts.Add(flStar);
		grid.FieldLayouts.Add(flAlways);
		grid.FieldLayouts.Add(flExtend);
	}
xmlns:igDP="http://infragistics.com/DataPresenter"

    
<igDP:XamDataGrid BindToSampleData="True">
        
<igDP:XamDataGrid.FieldLayoutSettings>
            
<!-- You can control the default AutoFitMode for 
                all FieldLayouts that haven't explicitly set their 
                AutoFitMode by either setting it on the DP's   
                FieldLayoutSettings. You can also set the previously 
                existing AutoFit property on the DataPresenterBase.
-->
            
<igDP:FieldLayoutSettings 
                
AutoFitMode="Never"
                
HeaderPrefixAreaDisplayMode="FieldChooserButton" 
                
/>
        
</igDP:XamDataGrid.FieldLayoutSettings>

        
<!-- Remove the key of one of these to use it in the sample -->
        
<igDP:XamDataGrid.FieldLayouts>
            
<!-- AutoFitMode of OnlyWithVisibleStarFields so as long as there are 
                star fields visible, the fields will fill the available area. 
-->
            
<igDP:FieldLayout Key="HasStarFields">
                
<igDP:Field Name="name" />
                
<igDP:Field Name="salary" />
                
<igDP:Field Name="email" Width="*" />
                
<igDP:Field Name="department" Width="2*" />

                
<igDP:FieldLayout.Settings>
                    
<igDP:FieldLayoutSettings AutoFitMode="OnlyWithVisibleStarFields" />
                
</igDP:FieldLayout.Settings>
            
</igDP:FieldLayout>

            
<!-- AutoFitMode of Always means all visible fields are resized to fill 
                the available area. The extent of fields may be increased or 
                decreased. 
-->
            
<igDP:FieldLayout Key="Always">
                
<igDP:Field Name="name" />
                
<igDP:Field Name="salary" />
                
<igDP:Field Name="email" />
                
<igDP:Field Name="department" />
                
                
<igDP:FieldLayout.Settings>
                    
<igDP:FieldLayoutSettings AutoFitMode="Always" />
                
</igDP:FieldLayout.Settings>
            
</igDP:FieldLayout>

            
<!-- AutoFitMode of ExtendLastField is a little different than the 
                other modes in that non-star fields will never be reduced. The 
                preferred sizes of the fields is used and if there is extra 
                space available the last field will be increased in width to 
                fill the available area. 
-->
            
<igDP:FieldLayout Key="ExtendLastField">
                
<igDP:Field Name="name" />
                
<igDP:Field Name="salary" />
                
<igDP:Field Name="email" />
                
<igDP:Field Name="department" Width="*" />

                
<igDP:FieldLayout.Settings>
                    
<igDP:FieldLayoutSettings AutoFitMode="ExtendLastField" />
                
</igDP:FieldLayout.Settings>
            
</igDP:FieldLayout>
        
</igDP:XamDataGrid.FieldLayouts>
    
</igDP:XamDataGrid>
参照