弹出窗口不会显示在模板中 [英] Popup is not diplayed in a template

查看:83
本文介绍了弹出窗口不会显示在模板中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我对Blend和弹出窗口有一个奇怪的问题。当我选择它们时,我的一些弹出窗口不会在设计时显示。

I have an odd issue with Blend and popups. Some of my popups don't display at design time when I select them.

要重现此问题,您可以获得上面的XAML代码。您应该在Blend中看到,当您:

To reproduce this issue you can get the XAML code above. You should see that, in Blend, when you :


  • 在UserControl中选择PP1时,会显示它,您可以看到它。
  • 编辑"对象和时间线"中的"CC_TemplateResource"的ContentTemplate"DTPopup"。选项卡 并在其中选择"PP2",它会显示,您可以看到它。
  • 编辑'CC_TemplateEmbeded'的ContentTemplate并在其中选择'PP3',它会显示,您可以看到它。
  • 直接从"资源"中编辑DTPopup。选项卡,它不显示,你看不到它。

有人可以重现这个问题吗?

Can anyone reproduce this issue ?


<UserControl x:Class="UserControl2"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="100" d:DesignWidth="100">
	<UserControl.Resources>
		<DataTemplate x:Key="DTPopup">
		    <Grid>
		        <Grid.RowDefinitions>
		            <RowDefinition/>
		        </Grid.RowDefinitions>
		        <Popup x:Name="PP2" >
		            <Grid Background="Green" Height="100" Width="100"/>
		        </Popup>
		    </Grid>			
		</DataTemplate>
	</UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>
		
        <ContentControl x:Name="CC_TemplateResource" Content="ContentControl" 
			ContentTemplate="{DynamicResource DTPopup}"/>
			
		<ContentControl x:Name="CC_TemplateEmbeded" Grid.Row="1">
            <ContentControl.ContentTemplate>
                <DataTemplate>
                    <Grid>
                        <Popup x:Name="PP3" Placement="Center">
                            <Grid Background="Green" Height="100" Width="100"/>
                        </Popup>
                    </Grid>

                </DataTemplate>
            </ContentControl.ContentTemplate>
        </ContentControl>
        <Popup x:Name="PP1" Grid.RowSpan="2" >
            <Grid Background="Green" Height="100" Width="100"/>
        </Popup>
    </Grid>
</UserControl>

推荐答案

为什么将ContentTemplate作为DynamicResource作为 它是一个StaticResource?
Why do you have the ContentTemplate as DynamicResource as  It is a StaticResource?


这篇关于弹出窗口不会显示在模板中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆