2014-03-25 50 views
1

显示弹出我有比该弹出短的网格元件内的弹出元件(弹出比网格更大)。当弹出窗口打开时,它显示网格的限制。WPF - 在它的父元素

试图设置的ChildTransitions:

<Popup.ChildTransitions> 
    <TransitionCollection> 
     <PopupThemeTransition /> 
    </TransitionCollection> 
</Popup.ChildTransitions> 

而弹出可完全同时显示过渡效果,但后来它的再次下调。我真的需要Grid中的Popup,它是一个自定义的UserControl。

可以弹出显现在以任何方式它的父元素?它适用于Windows应用商店应用项目。

谢谢!

+1

您不能在网格外定义弹出框吗? –

回答

2

试试这个:下面的代码对我的作品

<Page 
x:Class="App14.MainPage" 
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
xmlns:local="using:App14" 
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
mc:Ignorable="d"> 
<Grid Height="100" Width="100" Background="Red"> 
    <!--dont set height width to popup here --> 
    <Popup x:Name="Popup" IsOpen="True" >    
     <Border Height="200" Width="200" Background="RoyalBlue"> 
      <!--popup children here-->              
     </Border> 
    </Popup> 
</Grid> 

您可以使用Horizo​​ntalOffsetVerticalOffset弹出的属性设置目标的起源和弹出窗口之间的水平和垂直距离。

+0

谢谢!它像一个魅力。 – JordiVilaplana