ControlAdapter.Control Özellik

Tanım

Bu denetim bağdaştırıcısının bağlı olduğu denetime başvuru alır.

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

Özellik Değeri

Bunun ControlControlAdapter bağlı olduğu.

Öznitelikler

Örnekler

Aşağıdaki kod örneği, sınıfından Control bir özel denetimin nasıl türetildiğini ve ardından sınıfından devralan karşılık gelen bir bağdaştırıcının ControlAdapter nasıl oluşturulacağını gösterir. Bağdaştırıcı özelliğini geçersiz kılar Control ve denetime kesin olarak belirlenmiş bir başvuru döndürür.

#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

Açıklamalar

Türetilmiş bir denetim bağdaştırıcısı bir denetime bağlandığında, .NET Framework denetim üyeleri yerine belirli bağdaştırıcı üyelerini çağırır.

Devralanlara Notlar

sınıfından devraldığınızda, Örnek bölümünde gösterildiği gibi denetimin ControlAdapter kesin olarak türü belirlenmiş bir örneğini döndürmek için en azından bir Control özellik uygulamanız gerekir.

Şunlara uygulanır

Ayrıca bkz.