WizardStepCollection 类

定义

表示控件中用作向导的 WizardStepBase 派生类的集合。 此类不能被继承。

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 集合。

<%@ 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 集合。

<%@ 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>

下面是上一示例中网页的代码隐藏文件。

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

注解

WizardStepCollection 类用于在充当向导的 WizardStepBase控件(如 CreateUserWizard 控件或 Wizard 控件)中存储和管理派生对象的集合。 例如,控件 WizardWizardStepCollection 类用于其 WizardSteps 属性。

可通过多种方式访问 WizardStepBase以下 WizardStepCollection项中的 -derived 对象:

属性

Count

获取 WizardStepBase 控件的 Wizard 集合中从 WizardStepCollection 派生的对象数。

IsReadOnly

获取一个值,该值指示是否可修改集合中从 WizardStepBase 派生的对象。

IsSynchronized

获取一个值,该值指示对集合的访问是否已同步(线程安全)。

Item[Int32]

从集合中的指定索引处获取从 WizardStepBase 派生的对象。

SyncRoot

获取可用于同步对集合的访问的对象。

方法

Add(WizardStepBase)

将指定的从 WizardStepBase 派生的对象追加到集合的结尾。

AddAt(Int32, WizardStepBase)

将指定的从 WizardStepBase 派生的对象添加到集合中的指定索引位置。

Clear()

从集合中移除所有从 WizardStepBase 派生的对象。

Contains(WizardStepBase)

确定 WizardStepCollection 集合是否包含一个特定的从 WizardStepBase 派生的对象。

CopyTo(WizardStepBase[], Int32)

WizardStepCollection 集合中的所有项复制到兼容的、WizardStepBase 对象的一维数组,从目标数组的指定索引处开始。

Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
GetEnumerator()

返回 IEnumerator 实现的对象,该对象可用于循环访问集合中从 WizardStepBase 派生的对象。

GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
IndexOf(WizardStepBase)

确定索引值,该值表示集合中指定的从 WizardStepBase 派生的对象。

Insert(Int32, WizardStepBase)

将指定的从 WizardStepBase 派生的对象插入集合中的指定索引位置。

MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
Remove(WizardStepBase)

从集合中移除指定的从 WizardStepBase 派生的对象。

RemoveAt(Int32)

移除集合中位于指定位置的从 WizardStepBase 派生的对象。

ToString()

返回表示当前对象的字符串。

(继承自 Object)

显式接口实现

ICollection.CopyTo(Array, Int32)

WizardStepCollection 集合中的所有项复制到一维数组,从目标数组的指定索引处开始。

IList.Add(Object)

将指定对象追加到集合的结尾。

IList.Contains(Object)

确定集合中是否包含指定的对象。

IList.IndexOf(Object)

确定索引值,该值表示指定对象在集合中的位置。

IList.Insert(Int32, Object)

将指定的对象插入集合中的指定位置。

IList.IsFixedSize

获取一个值,该值指示集合是否具有固定大小。

IList.Item[Int32]

获取集合中指定索引处的对象。

IList.Remove(Object)

从集合中删除指定的对象。

扩展方法

Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。

OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。

AsParallel(IEnumerable)

启用查询的并行化。

AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryable

适用于

另请参阅