Bagikan melalui


WizardStepCollection Kelas

Definisi

Mewakili kumpulan objek turunan WizardStepBasedalam kontrol yang bertindak sebagai wizard. Kelas ini tidak dapat diwariskan.

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
Warisan
WizardStepCollection
Penerapan

Contoh

Contoh berikut menunjukkan cara mengisi WizardStepCollection koleksi menggunakan sintaks deklaratif.

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

Contoh berikut menunjukkan cara mengisi WizardStepCollection koleksi secara terprogram.

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

Berikut ini adalah file code-behind untuk halaman Web dalam contoh sebelumnya.

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

Keterangan

Kelas WizardStepCollection digunakan untuk menyimpan dan mengelola kumpulan objek turunan WizardStepBasedalam kontrol yang bertindak sebagai wizard, seperti CreateUserWizard kontrol atau Wizard kontrol. Misalnya, Wizard kontrol menggunakan WizardStepCollection kelas untuk propertinya WizardSteps .

Ada beberapa cara untuk mengakses WizardStepBaseobjek -turunan di WizardStepCollection:

  • Item[] Gunakan properti untuk langsung mengakses WizardStepBaseobjek -turunan pada indeks berbasis nol tertentu.

  • GetEnumerator Gunakan metode untuk membuat enumerator yang dapat digunakan untuk melakukan iterasi melalui koleksi.

  • CopyTo Gunakan metode untuk menyalin konten WizardStepCollection koleksi ke dalam Array objek.

Properti

Count

Mendapatkan jumlah WizardStepBaseobjek -turunan dalam Wizard koleksi kontrol WizardStepCollection .

IsReadOnly

Mendapatkan nilai yang menunjukkan apakah WizardStepBaseobjek -turunan dalam koleksi dapat dimodifikasi.

IsSynchronized

Mendapatkan nilai yang menunjukkan apakah akses ke koleksi disinkronkan (aman utas).

Item[Int32]

WizardStepBaseMendapatkan objek -turunan dari koleksi pada indeks yang ditentukan.

SyncRoot

Mendapatkan objek yang dapat digunakan untuk menyinkronkan akses ke koleksi.

Metode

Add(WizardStepBase)

Menambahkan objek -turunan yang ditentukan WizardStepBaseke akhir koleksi.

AddAt(Int32, WizardStepBase)

Menambahkan objek -turunan yang ditentukan WizardStepBaseke koleksi di lokasi indeks yang ditentukan.

Clear()

Menghapus semua WizardStepBaseobjek turunan dari koleksi.

Contains(WizardStepBase)

Menentukan apakah WizardStepCollection koleksi berisi objek -turunan tertentu WizardStepBase.

CopyTo(WizardStepBase[], Int32)

Menyalin semua item dari WizardStepCollection koleksi ke array WizardStepBase objek satu dimensi yang kompatibel, dimulai pada indeks yang ditentukan dalam array target.

Equals(Object)

Menentukan apakah objek yang ditentukan sama dengan objek saat ini.

(Diperoleh dari Object)
GetEnumerator()

Mengembalikan IEnumeratorobjek -implemented yang dapat digunakan untuk melakukan iterasi melalui WizardStepBaseobjek -turunan dalam koleksi.

GetHashCode()

Berfungsi sebagai fungsi hash default.

(Diperoleh dari Object)
GetType()

Mendapatkan instans Type saat ini.

(Diperoleh dari Object)
IndexOf(WizardStepBase)

Menentukan nilai indeks yang mewakili posisi objek -turunan yang ditentukan WizardStepBasedalam koleksi.

Insert(Int32, WizardStepBase)

Menyisipkan objek -turunan yang ditentukan WizardStepBaseke dalam koleksi pada lokasi indeks yang ditentukan.

MemberwiseClone()

Membuat salinan dangkal dari yang saat ini Object.

(Diperoleh dari Object)
Remove(WizardStepBase)

Menghapus objek -turunan yang ditentukan WizardStepBasedari koleksi.

RemoveAt(Int32)

WizardStepBaseMenghapus objek -turunan dari koleksi di lokasi yang ditentukan.

ToString()

Mengembalikan string yang mewakili objek saat ini.

(Diperoleh dari Object)

Implementasi Antarmuka Eksplisit

ICollection.CopyTo(Array, Int32)

Menyalin semua item dari WizardStepCollection koleksi ke array satu dimensi, dimulai dari indeks yang ditentukan dalam array target.

IList.Add(Object)

Menambahkan objek yang ditentukan ke akhir koleksi.

IList.Contains(Object)

Menentukan apakah koleksi berisi objek yang ditentukan.

IList.IndexOf(Object)

Menentukan nilai indeks yang mewakili posisi objek yang ditentukan dalam koleksi.

IList.Insert(Int32, Object)

Sisipkan objek yang ditentukan dalam koleksi pada posisi yang ditentukan.

IList.IsFixedSize

Mendapatkan nilai yang menunjukkan apakah koleksi memiliki ukuran tetap.

IList.Item[Int32]

Mendapatkan objek pada indeks yang ditentukan dalam koleksi.

IList.Remove(Object)

Menghapus objek yang ditentukan dari koleksi.

Metode Ekstensi

Cast<TResult>(IEnumerable)

Mentransmisikan elemen dari IEnumerable ke jenis yang ditentukan.

OfType<TResult>(IEnumerable)

Memfilter elemen berdasarkan IEnumerable jenis tertentu.

AsParallel(IEnumerable)

Mengaktifkan paralelisasi kueri.

AsQueryable(IEnumerable)

Mengonversi menjadi IEnumerableIQueryable.

Berlaku untuk

Lihat juga