darking050
darking050

Reputation: 637

Set the WP7 background image of panorama view from c# code

I want to change the background image for the panorama view in the WP7 from code.

First from XAML:-

<controls:Panorama Title="earth" Name="PanoObj">
   <controls:Panorama.Background>
      <ImageBrush ImageSource="background.jpg" />
   </controls:Panorama.Background>
</controls:Panorama> 

From the code side it is done from:-

$this.PanoObj.Background //It accepts the type Brush.

I really dont understand this as from XAML it is an ImageBrush but in code it is Brush. Please help me how to fix this or convert from ImageBrush to Brush.

thanks,

Upvotes: 0

Views: 2278

Answers (1)

Matt Lacey
Matt Lacey

Reputation: 65564

An ImageBrush is a Brush see the inheritance hierarchy.

You shouldn't need to cast (or convert it).

Upvotes: 2

Related Questions