DeviceSpecificChoiceとは? わかりやすく解説

DeviceSpecificChoice クラス

DeviceSpecific の Choice コンストラクトにある選択項目を 1 つ提供します。

名前空間: System.Web.UI.MobileControls
アセンブリ: System.Web.Mobile (system.web.mobile.dll 内)
構文構文

Public Class DeviceSpecificChoice
    Implements IParserAccessor, IAttributeAccessor
Dim instance As DeviceSpecificChoice
public class DeviceSpecificChoice : IParserAccessor,
 IAttributeAccessor
public ref class DeviceSpecificChoice : IParserAccessor,
 IAttributeAccessor
public class DeviceSpecificChoice implements
 IParserAccessor, IAttributeAccessor
public class DeviceSpecificChoice implements
 IParserAccessor, IAttributeAccessor
解説解説
使用例使用例

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

この例では、ブラウザが WML を必要とするか (isWML11)、またはカラー表示をサポートしているか (supportsColor) を確認するために関数を使用していますが、代わりに Web.config ファイルを使用して、これを自動で確認するために .NET Framework が自動的に使用する <DeviceSpecific> 要素を定義することも可能です。

<deviceFilters>
  <filter name="isWML11" 
          compare="PreferredRenderingType" 
          argument="wml11" />
  <filter name="supportsColor"
 
          compare="IsColor" 
          argument="true" />
</deviceFilters>
メモメモ

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

<%@ 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  >
<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="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  >
<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>
.NET Framework のセキュリティ.NET Framework のセキュリティ
継承階層継承階層
System.Object
  System.Web.UI.MobileControls.DeviceSpecificChoice
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DeviceSpecificChoice メンバ
System.Web.UI.MobileControls 名前空間
その他の技術情報
DeviceSpecific コントロールの概要
<Choice> 要素 (.NET Framework 開発者ガイド)
<DeviceSpecific> 要素

DeviceSpecificChoice コンストラクタ


DeviceSpecificChoice プロパティ


パブリック プロパティパブリック プロパティ

参照参照

関連項目

DeviceSpecificChoice クラス
System.Web.UI.MobileControls 名前空間

その他の技術情報

DeviceSpecific コントロールの概要
<Choice> 要素 (.NET Framework 開発者ガイド)
<DeviceSpecific> 要素

DeviceSpecificChoice メソッド


パブリック メソッドパブリック メソッド

プロテクト メソッドプロテクト メソッド
明示的インターフェイスの実装明示的インターフェイスの実装
  名前 説明
インターフェイスの明示的な実装 System.Web.UI.IAttributeAccessor.GetAttribute このメンバの説明については、「IAttributeAccessor.GetAttribute」を参照してください。
インターフェイスの明示的な実装 System.Web.UI.IAttributeAccessor.SetAttribute このメンバの説明については、「IAttributeAccessor.SetAttribute」を参照してください。
インターフェイスの明示的な実装 System.Web.UI.IParserAccessor.AddParsedSubObject このメンバの説明については、「IParserAccessor.AddParsedSubObject」を参照してください。
参照参照

関連項目

DeviceSpecificChoice クラス
System.Web.UI.MobileControls 名前空間

その他の技術情報

DeviceSpecific コントロールの概要
<Choice> 要素 (.NET Framework 開発者ガイド)
<DeviceSpecific> 要素

DeviceSpecificChoice メンバ

DeviceSpecific の Choice コンストラクトにある選択項目を 1 つ提供します。

DeviceSpecificChoice データ型で公開されるメンバを以下の表に示します。


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド DeviceSpecificChoice DeviceSpecificChoice クラスの新しいインスタンスを初期化します。
パブリック プロパティパブリック プロパティ
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
明示的インターフェイスの実装明示的インターフェイスの実装
  名前 説明
インターフェイスの明示的な実装 System.Web.UI.IAttributeAccessor.GetAttribute このメンバの説明については、「IAttributeAccessor.GetAttribute」を参照してください。
インターフェイスの明示的な実装 System.Web.UI.IAttributeAccessor.SetAttribute このメンバの説明については、「IAttributeAccessor.SetAttribute」を参照してください。
インターフェイスの明示的な実装 System.Web.UI.IParserAccessor.AddParsedSubObject このメンバの説明については、「IParserAccessor.AddParsedSubObject」を参照してください。
参照参照

関連項目

DeviceSpecificChoice クラス
System.Web.UI.MobileControls 名前空間

その他の技術情報

DeviceSpecific コントロールの概要
<Choice> 要素 (.NET Framework 開発者ガイド)
<DeviceSpecific> 要素



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「DeviceSpecificChoice」の関連用語

DeviceSpecificChoiceのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DeviceSpecificChoiceのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS