开发者

How to replace Pivot Application background from code-behind?

开发者 https://www.devze.com 2023-03-14 01:14 出处:网络
I\'m using custom background image in Pivot (not Panorama) Application: <controls:Pivot Title=\"My Application\">

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

精彩评论

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

关注公众号