自定义 WP7 弹出控件不显示内容
我正在尝试为显示 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>
I'm trying to create a user control for a full screen pop-up that shows the EULA. I'm having trouble getting my content to show and I'm not sure why. I've created other pop-up controls and I don't see any layout differences between those and this one.
In Expression Blend, I can click on the LayoutRoot node and it shows my background style, but no content. If I click on the popEula node, I see the entire content, including the background style. When I add the control to a page, I only see the background. I'm not sure why all my content is disappearing.
<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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我首先在弹出窗口上设置宽度和高度,并设置 IsOpen =“true”。看起来您的弹出窗口未打开或尺寸奇怪并且无法正确显示。
I would start by setting a width and heigh on your popup and also setting IsOpen = "true". Looks like your popup isnt open or is a weird size and not showing properly.