Building Microsoft ASP.NET Applications for Mobile Devices, Second Edition [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Building Microsoft ASP.NET Applications for Mobile Devices, Second Edition [Electronic resources] - نسخه متنی

Andy Wigley; Peter Roxburgh

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
توضیحات
افزودن یادداشت جدید






Chapter 4, we used this technique with the Image control to test which graphics file format a client supports, as the following code illustrates:

<mobile:Image runat="server" id="myImages" AlternateText="Northwind Corp.">
<DeviceSpecific>
<Choice Filter="isHTML32" ImageUrl="Northwindlogo.gif"/>
<Choice Filter="isWML11" ImageUrl="Northwindlogo.wbmp"/>
</DeviceSpecific>
</mobile:Image>

When a client requests the mobile page that contains this Image control, the runtime uses the capabilities of the mobile device to evaluate the <Choice> elements. If the isHTML32 filter returns True, the ImageURL property of the enclosing Image control is set to Northwindlogo.gif. If isWML11 returns True, the control will use Northwindlogo.wbmp. If neither of these is True, the ImageUrl property remains undefined, which, for the Image control, means that AlternateText will be displayed instead. The two device filters used in this example are defined in the application Web.config file, as explained in the first part of this chapter.

This example demonstrates one common usage of DeviceSpecific/Choice constructs: to override properties of the enclosing control if a particular device filter is true. Property overrides have the following uses:



Using different graphics filesYou do this when a client device supports different graphics formats.



Modifying text strings to account for differing display sizesYou might want to supply a longer version of a string on some devices but an abbreviated version on devices with smaller screens.



Supporting multilingual applicationsYou can set the Text properties differently depending on the preferred language of the client device.



Customizing style properties for particular devicesThe Mobile Internet Controls Runtime does a good job of using the font and color support capabilities of each client device when rendering controls. However, sometimes you might want to apply different style attributes to a particular device.



You can also use the DeviceSpecific/Choice construct with the templated controls to apply additional ASP.NET controls or appropriate device-specific markup. You'll learn more about these additional features later in this chapter, in the section "Using Templated Controls."

Defining Property Overrides in Visual Studio .NET


Visual Studio .NET provides graphical tools for defining and applying device filters, and to define property overrides. You must apply a device filter to the control where you want to use a property override. The way you do this was described earlier in this chapter, in the section "Defining Device Filters using Visual Studio .NET Tools." To define which properties to override when one of the applied device filters returns True, you must open the Property Overrides Editor. You access the Property Overrides Editor by clicking the ellipsis (…) button next to the (Property Overrides) entry in the control's Properties list, as Figure 9-6 shows.


Figure 9-6: The Property Overrides Editor

Select each applied device filter from the drop-down list, and select the property overrides you want the filter to apply to the control when the filter is chosen. You can alter the list of applied device filters by clicking the Edit button.

/ 145