自定义WP7弹出控件不显示内容

时间:2010-12-10 03:50:20

标签: c# silverlight xaml windows-phone-7 popup

我正在尝试为显示EULA的全屏弹出窗口创建用户控件。我无法显示我的内容,但我不确定原因。我已经创建了其他弹出控件,我没有看到它们和这个之间存在任何布局差异。

在Expression Blend中,我可以单击LayoutRoot节点,它显示我的背景样式,但没有内容。如果我单击popEula节点,我会看到整个内容,包括背景样式。当我将控件添加到页面时,我只看到背景。我不确定为什么我的所有内容都在消失。

<Grid x:Name="LayoutRoot" Style="{StaticResource MyBackgroundStyle}">
    <Popup x:Name="popEula">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>

            <!--This section is empty. Place new content here Grid.Row="1"-->
            <Grid Grid.Row="1" x:Name="ContentGrid" Margin="24, 0, 24, 0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="435" />
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <ScrollViewer x:Name="ScrollViewer">
                    <TextBlock x:Name="LicenseText" Style="{StaticResource MyTextNormalStyle}"
                Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum bibendum semper ante a vestibulum. Ut ultricies tellus sit amet sapien viverra tempus. Sed auctor pretium purus, eu ornare libero malesuada a. Vivamus dignissim vulputate nunc, a venenatis sapien condimentum quis. Nam vestibulum, neque molestie rhoncus rutrum, ante lacus vulputate odio, ac tristique augue lacus ac mi. Donec a sollicitudin diam. Nulla facilisi. Ut eu purus felis, id faucibus urna. Nullam luctus porttitor cursus. Curabitur auctor leo vitae lorem fringilla at egestas mi sollicitudin. Vestibulum blandit tempor orci vel iaculis. Sed eleifend bibendum dapibus. Sed sed elit ac libero consequat interdum sit amet vitae lacus. Donec sit amet velit et nulla placerat iaculis. Nunc aliquam sollicitudin cursus. Sed sed tincidunt augue. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum bibendum semper ante a vestibulum. Ut ultricies tellus sit amet sapien viverra tempus. Sed auctor pretium purus, eu ornare libero malesuada a. Vivamus dignissim vulputate nunc, a venenatis sapien condimentum quis. Nam vestibulum, neque molestie rhoncus rutrum, ante lacus vulputate odio, ac tristique augue lacus ac mi. Donec a sollicitudin diam. Nulla facilisi. Ut eu purus felis, id faucibus urna. Nullam luctus porttitor cursus. Curabitur auctor leo vitae lorem fringilla at egestas mi sollicitudin. Vestibulum blandit tempor orci vel iaculis. Sed eleifend bibendum dapibus. Sed sed elit ac libero consequat interdum sit amet vitae lacus. Donec sit amet velit et nulla placerat iaculis. Nunc aliquam sollicitudin cursus. Sed sed tincidunt augue."/>
                </ScrollViewer>

                <toolkit:WrapPanel Grid.Row="2" Margin="0, 48, 0, 0">
                    <Button x:Name="btnAccept" Style="{StaticResource MyButtonStyle}" Content="Accept" Width="150"/>
                    <Button x:Name="btnDecline" Style="{StaticResource MyButtonStyle}" Content="Decline" Width="150" Margin="20, 0, 0, 0" />
                </toolkit:WrapPanel>

            </Grid>
        </Grid>
    </Popup>
</Grid>

1 个答案:

答案 0 :(得分:3)

我首先在弹出窗口设置宽度和高度,然后设置IsOpen =“true”。看起来你的弹出窗口没有打开或者是一个奇怪的大小而且没有正确显示。