0

问题 我想在弹出窗口的背景中添加图像。我对 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>    

有什么建议么?提前致谢

4

1 回答 1

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>
于 2012-08-16T06:34:26.353 回答