Thursday, August 16, 2012

Adding image to background for a popup window in Silverlight

Adding image to background for a popup window in Silverlight

PROBLEM I want to add an image the background of a pop up. I am fairly new to Silverlight, so I apologize if there are some blatant, rookie errors in the following code

<Popup x:Name="MyPOP" HorizontalOffset="200" VerticalOffset="200" IsOpen="False"  >          <StackPanel Width="800" Height="800" Background="Red">             <Button Content="GO AMERICA" Click="Button_Click_1"  Width="100" Height="50" />             <Canvas>                 <TextBlock Text="THESE COLORS DON'T RUN!!!!" />             <Canvas.Background>                 <ImageBrush ImageSource="http://www.ilovethebronx.com/sites/default/files/events_pics/fireworks.jpg?1339518424"/>             </Canvas.Background>              </Canvas>             </StackPanel>      </Popup>     

Any suggestions? Thanks in advance

Answers & Comments...

Answer: 1

You simply need to set a Height on your Canvas, though I suspect that this is more like what you may be after:

<Popup x:Name="MyPOP" HorizontalOffset="200" VerticalOffset="200" IsOpen="True"  >          <Grid Width="800" Height="800" Background="Red">             <Grid.RowDefinitions>                 <RowDefinition Height="Auto" />                 <RowDefinition />             </Grid.RowDefinitions>             <Button Content="GO AMERICA" Click="Button_Click_1"  Width="100" Height="50" />             <Border Grid.Row="1">                 <TextBlock Text="THESE COLORS DON'T RUN!!!!" />                 <Border.Background>                     <ImageBrush ImageSource="http://www.ilovethebronx.com/sites/default/files/events_pics/fireworks.jpg?1339518424"/>                 </Border.Background>              </Border>         </Grid>      </Popup> 
Answer by TriggerPin for Adding image to background for a popup window in Silverlight




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog