WizardStepCollection 類別

定義

表示作為精靈之控制項中的 WizardStepBase 衍生物件集合。Represents a collection of WizardStepBase-derived objects in a control that acts as a wizard. 這個類別無法被繼承。This class cannot be inherited.

public ref class WizardStepCollection sealed : System::Collections::IList
public sealed class WizardStepCollection : System.Collections.IList
type WizardStepCollection = class
    interface IList
    interface ICollection
    interface IEnumerable
Public NotInheritable Class WizardStepCollection
Implements IList
繼承
WizardStepCollection
實作

範例

下列範例示範如何使用宣告式語法WizardStepCollection填入集合。The following example demonstrates how to populate the WizardStepCollection collection using declarative syntax.

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
      <asp:Wizard id="Wizard1" 
        runat="server" >
        <WizardSteps>
          <asp:WizardStep id="Step1" 
            runat="server" 
            title="Step 1">
          </asp:WizardStep>
          <asp:WizardStep id="Step2" 
            runat="server" 
            title="Step 2">
          </asp:WizardStep>
          <asp:WizardStep id="Step3" 
            runat="server" 
            title="Step 3">
          </asp:WizardStep>
          <asp:WizardStep id="Step4" 
            runat="server" 
            title="Step 4">
          </asp:WizardStep>
          <asp:WizardStep id="Step5" 
            runat="server" 
            title="Step 5">
          </asp:WizardStep>
          <asp:WizardStep id="Step6" 
            runat="server" 
            title="Step 6">
          </asp:WizardStep>
        </WizardSteps>
        <HeaderTemplate>
          <b>WizardStepCollection Example</b>
        </HeaderTemplate>
      </asp:Wizard>
    </form>
  </body>
</html>
<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
      <asp:Wizard id="Wizard1" 
        runat="server" >
        <WizardSteps>
          <asp:WizardStep id="Step1" 
            runat="server" 
            title="Step 1">
          </asp:WizardStep>
          <asp:WizardStep id="Step2" 
            runat="server" 
            title="Step 2">
          </asp:WizardStep>
          <asp:WizardStep id="Step3" 
            runat="server" 
            title="Step 3">
          </asp:WizardStep>
          <asp:WizardStep id="Step4" 
            runat="server" 
            title="Step 4">
          </asp:WizardStep>
          <asp:WizardStep id="Step5" 
            runat="server" 
            title="Step 5">
          </asp:WizardStep>
          <asp:WizardStep id="Step6" 
            runat="server" 
            title="Step 6">
          </asp:WizardStep>
        </WizardSteps>
        <HeaderTemplate>
          <b>WizardStepCollection Example</b>
        </HeaderTemplate>
      </asp:Wizard>
    </form>
  </body>
</html>

下列範例示範如何以程式設計方式填入WizardStepCollection集合。The following example demonstrates how to programmatically populate a WizardStepCollection collection.

<%@ Page Language="C#" CodeFile="WizardStepCollection.cs" Inherits="WizardStepCollectioncs_aspx" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>WizardStepCollection Example</title>
</head>
<body>
    <form id="Form1" runat="server">
      <h3>WizardStepCollection Example</h3>
      <asp:PlaceHolder id="PlaceHolder1" 
        runat="server" />
    </form>
  </body>
</html>
<%@ Page Language="VB" CodeFile="WizardStepCollection.vb" Inherits="WizardStepCollectionvb_aspx" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>WizardStepCollection Example</title>
</head>
<body>
    <form id="Form1" runat="server">
      <h3>WizardStepCollection Example</h3>
      <asp:PlaceHolder id="PlaceHolder1" 
        runat="server" />
    </form>
  </body>
</html>

以下是上述範例中網頁的程式碼後置檔案。The following is the code-behind file for the Web page in the preceding example.

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class WizardStepCollectioncs_aspx : System.Web.UI.Page
{ 

    void Page_Load(object sender, EventArgs e)
    {
        // Programmatically create a wizard control.
        Wizard Wizard1 = new Wizard();

        // Create steps for the wizard control and insert them
        // into the WizardStepCollection collection.
        for (int i = 0; i <= 5; i++)
        {
            WizardStepBase newStep = new WizardStep();
            newStep.ID = "Step" + (i + 1).ToString();
            newStep.Title = "Step " + (i + 1).ToString();
            Wizard1.WizardSteps.Add(newStep);
        }

        // Display the wizard control on the Web page.
        PlaceHolder1.Controls.Add(Wizard1);
    }
    
}
Partial Class WizardStepCollectionvb_aspx
    Inherits System.Web.UI.Page

    Public Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

        ' Programmatically create a wizard control.
        Dim Wizard1 As Wizard = New Wizard()

        ' Create steps for the wizard control and insert them
        ' into the WizardStepCollection collection.
        For i As Integer = 0 To 5
            Dim newStep As WizardStepBase = New WizardStep()
            newStep.ID = "Step" + (i + 1).ToString()
            newStep.Title = "Step " + (i + 1).ToString()
            Wizard1.WizardSteps.Add(newStep)
        Next

        ' Display the wizard control on the Web page.
        PlaceHolder1.Controls.Add(Wizard1)

    End Sub

End Class

備註

類別是用來在做CreateUserWizard為 wizard 的控制項 ( WizardStepBase例如控制項或Wizard控制項) 中儲存及管理衍生物件的集合。 WizardStepCollectionThe WizardStepCollection class is used to store and manage a collection of WizardStepBase-derived objects in a control that acts as a wizard, such as the CreateUserWizard control or the Wizard control. 例如, Wizard控制項WizardStepCollection使用類別做為其WizardSteps屬性。For example, the Wizard control uses the WizardStepCollection class for its WizardSteps property.

有多種方式可供您存取WizardStepBase WizardStepCollection中的衍生物件:There are multiple ways you can access the WizardStepBase-derived objects in the WizardStepCollection:

屬性

Count

取得 WizardStepBase 控制項之 Wizard 集合中 WizardStepCollection 衍生物件的數目。Gets the number of WizardStepBase-derived objects in the Wizard control's WizardStepCollection collection.

IsReadOnly

取得值,指出是否可以修改集合中的 WizardStepBase 衍生物件。Gets a value indicating whether the WizardStepBase-derived objects in the collection can be modified.

IsSynchronized

取得值,指出對集合的存取是否為同步的 (安全執行緒)。Gets a value indicating whether access to the collection is synchronized (thread-safe).

Item[Int32]

從指定索引的集合取得 WizardStepBase 衍生物件。Gets a WizardStepBase-derived object from the collection at the specified index.

SyncRoot

取得物件,這個物件可以用來對集合進行同步存取。Gets an object that can be used to synchronize access to the collection.

方法

Add(WizardStepBase)

將指定的 WizardStepBase 衍生物件附加到集合結尾。Appends the specified WizardStepBase-derived object to the end of the collection.

AddAt(Int32, WizardStepBase)

將指定的 WizardStepBase 衍生物件加入位於指定索引位置的集合。Adds the specified WizardStepBase-derived object to the collection at the specified index location.

Clear()

移除集合中所有 WizardStepBase 衍生物件。Removes all WizardStepBase-derived objects from the collection.

Contains(WizardStepBase)

判斷 WizardStepCollection 集合是否包含特定的 WizardStepBase 衍生物件。Determines whether the WizardStepCollection collection contains a specific WizardStepBase-derived object.

CopyTo(WizardStepBase[], Int32)

從目標陣列的指定索引開始,複製 WizardStepCollection 集合的所有項目至 WizardStepBase 物件的相容一維陣列。Copies all the items from a WizardStepCollection collection to a compatible one-dimensional array of WizardStepBase objects, starting at the specified index in the target array.

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetEnumerator()

傳回 IEnumerator 實作的物件,該物件可用於逐一查看集合中的 WizardStepBase 衍生物件。Returns an IEnumerator-implemented object that can be used to iterate through the WizardStepBase-derived objects in the collection.

GetHashCode()

作為預設雜湊函數。Serves as the default hash function.

(繼承來源 Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
IndexOf(WizardStepBase)

判斷索引值,該索引值代表集合中指定 WizardStepBase 衍生物件之位置。Determines the index value that represents the position of the specified WizardStepBase-derived object in the collection.

Insert(Int32, WizardStepBase)

將指定的 WizardStepBase 衍生物件插入位於指定索引位置的集合。Inserts the specified WizardStepBase-derived object into the collection at the specified index location.

MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
Remove(WizardStepBase)

移除集合中指定的 WizardStepBase 衍生物件。Removes the specified WizardStepBase-derived object from the collection.

RemoveAt(Int32)

移除指定位置集合中的 WizardStepBase 衍生物件。Removes the WizardStepBase-derived object from the collection at the specified location.

ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

明確介面實作

ICollection.CopyTo(Array, Int32)

從目標陣列的指定索引開始,複製 WizardStepCollection 集合的所有項目至一維陣列。Copies all the items from a WizardStepCollection collection to a one-dimensional array, starting at the specified index in the target array.

IList.Add(Object)

將指定的物件附加到集合結尾。Appends the specified object to the end of the collection.

IList.Contains(Object)

判斷集合是否包含指定的物件。Determines whether the collection contains the specified object.

IList.IndexOf(Object)

判斷索引值,該索引值代表集合中指定物件之位置。Determines the index value that represents the position of the specified object in the collection.

IList.Insert(Int32, Object)

將指定的物件插入位於指定位置的集合。Inserts the specified object in the collection at the specified position.

IList.IsFixedSize

取得值,這個值表示集合的大小是否是固定的。Gets a value indicating whether the collection has a fixed size.

IList.Item[Int32]

取得位於此集合指定索引處的物件。Gets the object at the specified index in the collection.

IList.Remove(Object)

從集合中移除指定的物件。Removes the specified object from the collection.

擴充方法

Cast<TResult>(IEnumerable)

IEnumerable 的項目轉換成指定的型別。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

根據指定的型別來篩選 IEnumerable 的項目。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

啟用查詢的平行化作業。Enables parallelization of a query.

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryableConverts an IEnumerable to an IQueryable.

適用於

另請參閱