SPViewStyleCollection Class
The SPViewStyleCollection class represents a collection of SPViewStyle objects.
System.Object
Microsoft.SharePoint.SPBaseCollection
Microsoft.SharePoint.SPViewStyleCollection
Public Constructors
The following table shows the public constructors of the SPViewStyleCollection class and a brief description of each.
Name | Description |
---|---|
SPViewStyleCollection | Initializes a new instance of the SPViewStyleCollection class. |
Public Methods
The following table shows the public methods of the SPViewStyleCollection class and a brief description of each.
Name | Description |
---|---|
StyleByID | Returns the view style with the specified ID from the collection. |
Public Properties
The following table shows the public properties of the SPViewStyleCollection class, the data type of each property, and a brief description of each.
Name | Data Type | Description |
---|---|---|
Count | Int32 | Gets the number of view styles in the collection. |
Item(Int32) | Microsoft.SharePoint.SPViewStyle | Gets the view style object at the specified index in the collection. |
Item(String) | Microsoft.SharePoint.SPViewStyle | Gets the view style object with the specified name from the collection. |
Web | Microsoft.SharePoint.SPWeb | Gets the parent Web site for the collection. |
Thread Safety
Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread safe.
Remarks
View styles are defined in either of two front-end VWSTYLE.XML files located in the Local_Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\TEMPLATE\1033\MPS\XML directory or the Local_Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\TEMPLATE\1033\STS\XML directory.
Use the ViewStyles property of the SPWeb class to return the collection of view styles for a site. Use an indexer to return a single view style from the collection. For example, if the collection is assigned to a variable named myViewStyles, use myViewStyles[index]
in C#, or myViewStyles(index)
in Visual Basic .NET, where index is the index number of the view style in the collection.
Example
The following example applies a Boxed style (13) to a view for a list in the specified site.
This example requires using directives (Imports in Visual Basic) for both the Microsoft.SharePoint and Microsoft.SharePoint.WebControls namespaces.
Requirements
Namespace: Microsoft.SharePoint
Platforms: Microsoft Windows Server 2003
Assembly: Windows SharePoint Services (in Microsoft.SharePoint.dll)
Security: Code Access Security