繁体   English   中英

在按钮WP7中将源绑定到图像

[英]Binding source to image in button WP7

我实际上是试图将图像源绑定到我的按钮中的图像,不知道什么是错的但没有出现......

这是我的xaml

<Grid>
    <Grid x:Name="FakeGridBig" Background="White" Opacity="0.1" 
        HorizontalAlignment="Left" Width="714" Height="269" Margin="3,0,0,0"></Grid>
    <Button  x:Name="Featured_Big" MouseEnter="Featured_Big_MouseEnter_1"
        MouseLeave="Featured_Big_MouseLeave"
        ContentTemplate="{StaticResource FeaturedBig}" 
        Style="{StaticResource BlackOpacityButton}" 
        BorderThickness="0" VerticalAlignment="Top" Margin="0,0,11,0">
        <i:Interaction.Triggers>
            <i:EventTrigger EventName="Click" >
                <gs:EventToCommand Command="{Binding FeaturedBigImage.InnerCommand1}"/>
            </i:EventTrigger>
        </i:Interaction.Triggers>      
        <Image x:Name="bigimage" Height="269" Width="714" ></Image>
    </Button>                       
</Grid>

这就是背后的代码,uri实际上是好的......

Uri uri = new Uri(FeaturedSmallImage1.Image1,UriKind.Absolute);
BitmapImage bmp = new BitmapImage(uri);
View.bigimage.Source = bmp;

我想你可能可能就是这条线......

ContentTemplate="{StaticResource FeaturedBig}" 

根据模板的外观,它可以覆盖您尝试使用的图像。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM