...">

Change the photo while Panorama is working

I have a Panorama xaml control:

<Grid x:Name="LayoutRoot"> <controls:Panorama Title="my application"> v <!--Assigns a background image to the Panorama control.--> <controls:Panorama.Background> <ImageBrush ImageSource="samplePhoto.jpg"/> </controls:Panorama.Background> <!--Panorama item one--> <controls:PanoramaItem Header="item1"> <Grid/> </controls:PanoramaItem> 

How can I change the image of samplePhoto.jpg in C #? thanks

+2
source share
2 answers

Such a snippet will do the trick:

 BitmapImage image = new BitmapImage(new Uri("IMAGE_URI",UriKind.Absolute)); ImageBrush b = new ImageBrush(); b.ImageSource = image; <PANORAMA_CONTROL>.Background = b; 

BitmapImage can also upload online images, so if there is an image accessible through a website / service, you can directly pass the URL.

+3
source
+3
source

Source: https://habr.com/ru/post/1346437/


All Articles