0

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

这是我的xml

<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;
4

1 回答 1

2

我会说你可能与这条线有关......

ContentTemplate="{StaticResource FeaturedBig}" 

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

于 2012-05-10T17:29:15.103 回答