风格触发的Windows Phone 7 [英] Style triggers in Windows Phone 7

查看:175
本文介绍了风格触发的Windows Phone 7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用的风格,Windows Phone 7的触发取决于一个布尔变量来改变图像的来源。

I want to use the style triggers in Windows Phone 7 to change the source of an image depending a boolean variable.

我文恩做这样的事情:

<Image Source="/Century21;component/Images/appbar.favs.addto.rest.png" Name="IconButtonSelection">
<Image.Style>
    <Style TargetType="Image">
        <Setter Property="Source" Value="/Century21;component/Images/appbar.favs.addto.rest.png"></Setter>
        <Style.Triggers>
            <DataTrigger Binding="{Binding IsSelected}" Value="True">
                <Setter Property="Source" Value="/Century21;component/Images/appbar.check.rest.png"></Setter>
            </DataTrigger>
        </Style.Triggers>
    </Style>
</Image.Style>

是否有可能使用datatrigger随着Windows Phone 7?
我究竟做错了什么?

Is it possible to use datatrigger with windows phone 7 ? What am i doing wrong ?

感谢;)

推荐答案

Silverlight 3中(上WP7的框架为基础)不支持风格的触发器。你可以申请一个触发器到图片元素本身,而不是风格,但你需要获得 DataTrigger 从某处。你也许可以将其拉出混合SDK的。

Silverlight 3 (on which the WP7 framework is based) doesn't support style triggers. You could apply a trigger to the Image element itself instead of the style, but you'd need to get hold of an implementation of DataTrigger from somewhere. You can probably pull it out of the Blend SDK.

这篇关于风格触发的Windows Phone 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆