全景图片标题(绑定图片路径) [英] Panorama Image Title (bind image path)

查看:25
本文介绍了全景图片标题(绑定图片路径)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在使用图像作为全景标题时是否可以绑定图像路径,我需要绑定源的原因是当用户将手机背景设置为白色"时,徽标将是黑色,反之亦然.

I was wondering if it's possible to bind the image path when using an Image as the Panorama Title, the reason why I need a bind for the Source is that when the user have the phone background to "white" the logo would be black, and vice versa.

这是我正在使用的代码:

This is the code I'm using:

<controls:Panorama.TitleTemplate>  
<DataTemplate>
    <Image Source="/PanoramaApp5;component/Images/logo.png"  Margin="14,105,0,10" HorizontalAlignment="Left" Name="logo" Stretch="Fill" VerticalAlignment="Top" Width="700" Height="70"/>
    <!--<TextBlock Text="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}" FontSize="100" Margin="10,50,0,0" />-->
    </DataTemplate> 
</controls:Panorama.TitleTemplate>

如果我使用默认标题(即文本),它会工作得很好,但我需要它作为图像.

If I let the default Title (which is text), it will work just fine, but I need it as an image.

推荐答案

只需为您的图像源设置一个空绑定,然后使用全景图的 Title 属性分配它:

Just set an empty binding for your image source, then assign it using the Title property of your panorama:

<controls:Panorama x:Name="Panorama">
    <controls:Panorama.TitleTemplate>
        <DataTemplate>
            <Image Source="{Binding}" />
        </DataTemplate>
    </controls:Panorama.TitleTemplate>
</controls:Panorama>

然后从后面的代码:

this.Panorama.Title = new Uri("uri of your picture");

这篇关于全景图片标题(绑定图片路径)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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