ControlAdapter.Control Vlastnost

Definice

Získá odkaz na ovládací prvek, ke kterému je tento ovládací adaptér připojen.

protected:
 property System::Web::UI::Control ^ Control { System::Web::UI::Control ^ get(); };
[System.ComponentModel.Browsable(false)]
protected System.Web.UI.Control Control { get; }
[<System.ComponentModel.Browsable(false)>]
member this.Control : System.Web.UI.Control
Protected ReadOnly Property Control As Control

Hodnota vlastnosti

Control

K Control němuž je připojeno ControlAdapter .

Atributy

Příklady

Následující příklad kódu ukazuje, jak odvodit vlastní ovládací prvek z Control třídy a pak vytvořit odpovídající adaptér, který dědí z ControlAdapter třídy. Adaptér přepíše Control vlastnost a vrátí odkaz silného typu na ovládací prvek.

#using <System.Web.Mobile.dll>
#using <System.dll>
#using <System.Web.dll>

using namespace System;
using namespace System::Web::UI;
using namespace System::Web::UI::Adapters;
using namespace System::Web::UI::WebControls;

public ref class CustomControl: public Control{};

public ref class CustomControlAdapter: public ControlAdapter
{
public:

   property System::Web::UI::Control^ Control 
   {
      // Return a strongly-typed reference to your custom control.
      System::Web::UI::Control^ get()
      {
         return (CustomControl^)ControlAdapter::Control;
      }
   }
   // Override other ControlAdapter members, as necessary. 
};
using System;
using System.Web.UI;
using System.Web.UI.Adapters;
using System.Web.UI.WebControls;

public class CustomControl : Control
{
    // Add your custom control code.
}

public class CustomControlAdapter : ControlAdapter
{
    // Return a strongly-typed reference to your custom control.
    public new CustomControl Control
    {
        get
        {
            return (CustomControl)base.Control;
        }

        // Override other ControlAdapter members, as necessary. 
    }
}
Imports System.Web.UI
Imports System.Web.UI.Adapters
Imports System.Web.UI.WebControls

Public Class CustomControl
    Inherits Control

    ' Add your custom control code.

End Class

Public Class CustomControlAdapter
    Inherits ControlAdapter

    ' Return a strongly-typed reference to your custom control.
    Public Shadows ReadOnly Property Control() As CustomControl
        Get
            Return CType(MyBase.Control, CustomControl)
        End Get
    End Property

    ' Override other ControlAdapter member as necessary. 

End Class

Poznámky

Při připojení odvozeného řídicího adaptéru k ovládacímu prvku .NET Framework volá určité členy adaptéru místo členů ovládacího prvku.

Poznámky pro dědice

Pokud dědíte z ControlAdapter třídy minimálně, měli byste implementovat Control vlastnost pro vrácení silně typ instance ovládacího prvku, jak je znázorněno v části Příklad.

Platí pro

Viz také