FilterableAttribute 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
指定套用屬性的屬性是否支援裝置篩選。 此類別無法獲得繼承。
public ref class FilterableAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Property)]
public sealed class FilterableAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Property)>]
type FilterableAttribute = class
inherit Attribute
Public NotInheritable Class FilterableAttribute
Inherits Attribute
- 繼承
- 屬性
範例
以下程式碼範例示範如何對自訂控制項的屬性套用 FilterableAttribute 屬性,以表示該屬性不支援裝置過濾。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Samples.AspNet.CS.Controls
{
public class SimpleCustomControl : WebControl
{
private string _productID;
// Set Filterable attribute to specify that this
// property does not support device filtering.
[Bindable(true)]
[Filterable(false)]
public string ProductID
{
get
{
return _productID;
}
set
{
_productID = value;
}
}
}
}
Imports System.ComponentModel
Imports System.Web.UI
Namespace Samples.AspNet.VB.Controls
Public Class SimpleCustomControl
Inherits System.Web.UI.WebControls.WebControl
Dim _productID As String
' Set Filterable attribute to specify that this
' property does not support device filtering.
<Bindable(True), Filterable(False)> Property ProductID() As String
Get
Return _productID
End Get
Set(ByVal Value As String)
_productID = Value
End Set
End Property
End Class
End Namespace
備註
屬性 FilterableAttribute 套用到屬性上,用以指定該屬性是否支援裝置過濾。 當某個屬性支援裝置過濾時,你可以透過指定裝置過濾器來覆蓋特定裝置屬性的值。 預設屬性是可過濾的,因此控制開發者可以透過將屬性設定 FilterableAttribute 為 false來防止物件被過濾。 欲了解更多資訊,請參閱「 針對特定裝置的客製化」。
欲了解更多屬性的使用資訊,請參閱屬性。
如需 FilterableAttribute 類別實例的初始屬性值清單,請參閱 FilterableAttribute 建構函式。
建構函式
| 名稱 | Description |
|---|---|
| FilterableAttribute(Boolean) |
初始化 FilterableAttribute 類別的新執行個體。 |
欄位
| 名稱 | Description |
|---|---|
| Default |
代表 FilterableAttribute 一個預設物件,並設定為預設屬性。 此欄位僅供讀取。 |
| No |
代表一個預先定義 FilterableAttribute 的物件,表示某屬性不支援裝置過濾。 此欄位僅供讀取。 |
| Yes |
代表一個預先定義 FilterableAttribute 的物件,表示某屬性支援裝置過濾。 此欄位僅供讀取。 |
屬性
| 名稱 | Description |
|---|---|
| Filterable |
會得到一個值,表示該屬性套用的屬性 FilterableAttribute 是否支援裝置過濾。 |
| TypeId |
在衍生類別中實作時,取得這個 Attribute的唯一標識碼。 (繼承來源 Attribute) |
方法
| 名稱 | Description |
|---|---|
| Equals(Object) |
判斷該類別目前的實例 FilterableAttribute 是否等於指定物件。 |
| GetHashCode() |
傳回這個實例的哈希碼。 |
| GetType() |
取得目前實例的 Type。 (繼承來源 Object) |
| IsDefaultAttribute() |
判斷該類別目前的實例 FilterableAttribute 是否等於該 Default 屬性。 |
| IsObjectFilterable(Object) |
判斷指定的 Object 裝置是否支援裝置過濾。 |
| IsPropertyFilterable(PropertyDescriptor) |
判斷屬性是否支援裝置過濾。 |
| IsTypeFilterable(Type) |
判斷指定的資料型態是否支援裝置過濾。 |
| Match(Object) |
在衍生類別中覆寫時,傳回值,指出這個實例是否等於指定的物件。 (繼承來源 Attribute) |
| MemberwiseClone() |
建立目前 Object的淺層複本。 (繼承來源 Object) |
| ToString() |
傳回表示目前 物件的字串。 (繼承來源 Object) |
明確介面實作
| 名稱 | Description |
|---|---|
| _Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) |
將一組名稱對應至一組對應的分派識別項 (Dispatch Identifier)。 (繼承來源 Attribute) |
| _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) |
擷取 物件的型別資訊,可用來取得介面的類型資訊。 (繼承來源 Attribute) |
| _Attribute.GetTypeInfoCount(UInt32) |
擷取物件提供的類型資訊介面數目 (0 或 1)。 (繼承來源 Attribute) |
| _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) |
提供物件所公開屬性和方法的存取權。 (繼承來源 Attribute) |