开发者

How to replace Pivot Application background from code-behind?

I'm using custom background image in Pivot (not Panorama) Application:

<controls:Pivot Title="My Application">
<controls:Pivot.Background>
    <ImageBrush ImageSource="Theme1.png开发者_如何学Python" Stretch="Fill"/>
</controls:Pivot.Background>

It works fine, but I would like to replace the image at run-time. Is it possible?


You can give your ImageBrush a name:

<ImageBrush x:Name="ibPivot" ImageSource="Theme1.png" Stretch="Fill"/>

Then change the source in the code-behind:

BitmapImage bi = new BitmapImage(new Uri("mySecondImage.png", UriKind.Relative));
ibPivot.ImageSource = bi;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜