2014-03-25 51 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