共用方式為


DataRepeater.LayoutStyle Property

Gets or sets a value that determines whether a DataRepeater control will be displayed with a vertical or horizontal orientation.

Namespace:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

Syntax

'宣告
Public Property LayoutStyle As DataRepeaterLayoutStyles
    Get
    Set
public DataRepeaterLayoutStyles LayoutStyle { get; set; }
public:
property DataRepeaterLayoutStyles LayoutStyle {
    DataRepeaterLayoutStyles get ();
    void set (DataRepeaterLayoutStyles value);
}
member LayoutStyle : DataRepeaterLayoutStyles with get, set
function get LayoutStyle () : DataRepeaterLayoutStyles
function set LayoutStyle (value : DataRepeaterLayoutStyles)

Property Value

Type: Microsoft.VisualBasic.PowerPacks.DataRepeaterLayoutStyles
One of the enumeration values that specifies the layout.

Remarks

The LayoutStyle property of a DataRepeater control determines whether DataRepeater items are displayed in a vertical or a horizontal format. When this property changes, you can use the LayoutStyleChanged event handler and the BeginResetItemTemplate and EndResetItemTemplate methods to rearrange the child controls in the ItemTemplate to fit the new layout.

Examples

The following example shows how to respond to the LayoutStyleChanged event in an event handler. This example requires that you have a DataRepeater control named DataRepeater1 on a form and that it contain two TextBox controls named TextBox1 and TextBox2.

' Switch the orientation.
If DataRepeater1.LayoutStyle =
 PowerPacks.DataRepeaterLayoutStyles.Vertical Then
    DataRepeater1.LayoutStyle =
     PowerPacks.DataRepeaterLayoutStyles.Horizontal
Else
    DataRepeater1.LayoutStyle =
     PowerPacks.DataRepeaterLayoutStyles.Vertical
End If
// Switch the orientation.
if (dataRepeater1.LayoutStyle == DataRepeaterLayoutStyles.Vertical)
{
    dataRepeater1.LayoutStyle = DataRepeaterLayoutStyles.Horizontal;
}
else
{
    dataRepeater1.LayoutStyle = DataRepeaterLayoutStyles.Vertical;
}            

.NET Framework Security

See Also

Reference

DataRepeater Class

Microsoft.VisualBasic.PowerPacks Namespace

BeginResetItemTemplate

EndResetItemTemplate

Other Resources

Introduction to the DataRepeater Control (Visual Studio)

How to: Change the Layout of a DataRepeater Control (Visual Studio)