DeviceSpecificChoice クラス

定義

注意事項

The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.

DeviceSpecific の Choice コンストラクトにある選択項目を 1 つ提供します。 ASP.NET モバイル アプリケーションを開発する方法については、「ASP.NET を使用した Mobile Apps & サイト」を参照してください。

public ref class DeviceSpecificChoice : System::Web::UI::IAttributeAccessor, System::Web::UI::IParserAccessor
[System.Web.UI.MobileControls.PersistName("Choice")]
public class DeviceSpecificChoice : System.Web.UI.IAttributeAccessor, System.Web.UI.IParserAccessor
[System.Web.UI.MobileControls.PersistName("Choice")]
[System.Obsolete("The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.")]
public class DeviceSpecificChoice : System.Web.UI.IAttributeAccessor, System.Web.UI.IParserAccessor
[<System.Web.UI.MobileControls.PersistName("Choice")>]
type DeviceSpecificChoice = class
    interface IParserAccessor
    interface IAttributeAccessor
[<System.Web.UI.MobileControls.PersistName("Choice")>]
[<System.Obsolete("The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.")>]
type DeviceSpecificChoice = class
    interface IParserAccessor
    interface IAttributeAccessor
Public Class DeviceSpecificChoice
Implements IAttributeAccessor, IParserAccessor
継承
DeviceSpecificChoice
属性
実装

次のコード例は、イメージ内の <Choice> 要素を示しています。 属性は Source 、コントロールの ImageUrl プロパティを Image オーバーライドします。

この例では関数を使用して、ブラウザーで WML () が必要かどうか、または色 (isWML11supportsColor) をサポートしているかどうかを判断しますが、代わりに Web.config ファイルを使用して、.NET Frameworkが自動的に決定に使用する要素を定義<DeviceSpecific>できます。

Note

次のコード サンプルでは、単一ファイルコード モデルを使用しており、分離コード ファイルに直接コピーすると正しく動作しない場合があります。 このコード サンプルは、拡張子が .aspx の空のテキスト ファイルにコピーする必要があります。 詳細については、「ASP.NET Web Forms ページ構文の概要」を参照してください。

<%@ Page Language="C#" 
    Inherits="System.Web.UI.MobileControls.MobilePage" %>
<%@ Register TagPrefix="mobile" 
    Namespace="System.Web.UI.MobileControls" 
    Assembly="System.Web.Mobile" %>
<%@ Import Namespace="System.Web.Mobile" %>

<script runat="server">
    private bool supportsColor(MobileCapabilities caps, string optValue)
    {
        // Determine if the browser is not a Web crawler and
        // can display in color
        if (!caps.Crawler && caps.IsColor)
            return true;
        return false;
    }

    private bool isWML11(MobileCapabilities caps, string optValue)
    {
        // Determine if the browser is not a Web crawler and
        // requires WML markup
        if (!caps.Crawler && caps.PreferredRenderingType ==
            MobileCapabilities.PreferredRenderingTypeWml11)
            return true;
        return false;
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
    <mobile:form id="form1" runat="server">
        <mobile:Image ID="Image1" runat="server" 
            AlternateText="Cannot display this image.">
            <DeviceSpecific>
                <choice Filter ="isWML11" ImageURL="wmlImage.wbmp" />
                <choice Filter="supportsColor" ImageURL="colorImage.gif" />
                <choice ImageURL="monoImg.gif" />
            </DeviceSpecific>
        </mobile:Image>
    </mobile:form>
</body>
</html>
<%@ Page Language="VB" 
    Inherits="System.Web.UI.MobileControls.MobilePage" %>
<%@ Register TagPrefix="mobile" 
    Namespace="System.Web.UI.MobileControls" 
    Assembly="System.Web.Mobile" %>
<%@ Import Namespace="System.Web.Mobile" %>

<script runat="server">
    Private Function supportsColor(ByVal caps As MobileCapabilities, _
        ByVal value As String) As Boolean
        
        ' Determine if the browser is not a Web crawler and
        ' can display in color
        If Not caps.Crawler And caps.IsColor Then
            Return True
        Else
            Return False
        End If
    End Function

    Private Function isWML11(ByVal caps As MobileCapabilities, _
        ByVal value As String) As Boolean

        ' Determine if the browser is not a Web crawler and
        ' requires WML markup
        If (Not caps.Crawler) AndAlso caps.PreferredRenderingType = _
            MobileCapabilities.PreferredRenderingTypeWml11 Then
            Return True
        Else
            Return False
        End If
    End Function
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
    <mobile:form id="form1" runat="server">
        <mobile:Image ID="Image1" runat="server" 
            AlternateText="Cannot display this image.">
            <DeviceSpecific>
                <choice Filter ="isWML11" ImageURL="wmlImage.wbmp" />
                <choice Filter="supportsColor" ImageURL="colorImage.gif" />
                <choice ImageURL="monoImg.gif" />
            </DeviceSpecific>
        </mobile:Image>
    </mobile:form>
</body>
</html>

注釈

このクラスは Choice> 要素に<似ています。 選択肢は、DeviceSpecific> 要素内に表示される順序で<テストされます。 要素の プロパティを Filter 指定する <Choice> 場合、その値は、Machine.config ファイルの セクションで定義されている <deviceFilters> デバイス フィルターの名前である必要があります。 実行時に、ASP.NET は、現在のデバイスの機能に対して指定されたデバイス フィルターを評価します。 成功した場合は、選択が選択されます。 プロパティを Filter 指定しない場合は、要素の既定値が <Choice> 選択されます。

コンストラクター

DeviceSpecificChoice()
古い.

DeviceSpecificChoice クラスの新しいインスタンスを初期化します。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「ASP.NET を使用した Mobile Apps & サイト」を参照してください。

プロパティ

Argument
古い.

Filter プロパティに使用する引数を取得または設定します。 既定値は null です。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「ASP.NET を使用した Mobile Apps & サイト」を参照してください。

Contents
古い.

DeviceSpecific の Choice コンストラクト内の選択項目に対して定義されているオーバーライドされるプロパティを取得します。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「ASP.NET を使用した Mobile Apps & サイト」を参照してください。

Filter
古い.

デバイス フィルターの名前を取得または設定します。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「ASP.NET を使用した Mobile Apps & サイト」を参照してください。

HasTemplates
古い.

DeviceSpecific 要素で現在選択されている選択肢に<テンプレートが定義されているかどうかを示す値を取得します。> この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「ASP.NET を使用した Mobile Apps & サイト」を参照してください。

Templates
古い.

Choice 要素で定義されているテンプレートを<取得します。> この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「ASP.NET を使用した Mobile Apps & サイト」を参照してください。

Xmlns
古い.

Choice 要素のマークアップの種類を<取得または設定します。> この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「ASP.NET を使用した Mobile Apps & サイト」を参照してください。

メソッド

AddParsedSubObject(Object)
古い.

Object オブジェクトの DeviceSpecificChoice オブジェクトに Templates を追加します。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「ASP.NET を使用した Mobile Apps & サイト」を参照してください。

Equals(Object)
古い.

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetAttribute(String)
古い.

DeviceSpecificChoice オブジェクトから指定した属性を返します。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「ASP.NET を使用した Mobile Apps & サイト」を参照してください。

GetHashCode()
古い.

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()
古い.

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()
古い.

現在の Object の簡易コピーを作成します。

(継承元 Object)
SetAttribute(String, String)
古い.

指定した値を、key で指定した属性に代入します。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「ASP.NET を使用した Mobile Apps & サイト」を参照してください。

ToString()
古い.

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

明示的なインターフェイスの実装

IAttributeAccessor.GetAttribute(String)

この API は製品インフラストラクチャをサポートします。コードから直接使用するものではありません。

古い.

このメンバーの詳細については、「GetAttribute(String)」をご覧ください。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「ASP.NET を使用した Mobile Apps & サイト」を参照してください。

IAttributeAccessor.SetAttribute(String, String)

この API は製品インフラストラクチャをサポートします。コードから直接使用するものではありません。

古い.

このメンバーの詳細については、「SetAttribute(String, String)」をご覧ください。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「ASP.NET を使用した Mobile Apps & サイト」を参照してください。

IParserAccessor.AddParsedSubObject(Object)
古い.

このメンバーの詳細については、「AddParsedSubObject(Object)」をご覧ください。 この API は、互換性のために残されています。 ASP.NET モバイル アプリケーションを開発する方法については、「ASP.NET を使用した Mobile Apps & サイト」を参照してください。

適用対象

こちらもご覧ください