2012-08-15 75 views
0

問題 我想添加圖像彈出的背景。我是相當新的Silverlight的,所以我很抱歉,如果有下面的代碼將圖像添加到Silverlight的彈出窗口的背景

<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>  

任何建議一些非常明顯,新秀的錯誤?在此先感謝

回答

1

您只需設置一個高度上你的畫布,但我懷疑這是更喜歡你可能是什麼後:

<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> 
+0

工作!謝謝您的幫助! – zach 2012-08-16 12:29:10