2016-08-24 15 views

回答

0

無法使標準對話框無模式。爲了達到你想要的效果,你應該在你的頁面頂部使用一個自定義的面板來處理與之相關的操作事件。例如:

<Grid x:Name="LayoutRoot"> 
    <!-- some other content --> 

    <Grid x:Name="Dialog" Background="Red" Width="200" Height="100" 
      ManipulationMode="All" ManipulationDelta="Dialog_OnManipulationDelta"> 

     <Grid.RenderTransform> 
      <CompositeTransform x:Name="DialogTransform" /> 
     </Grid.RenderTransform> 
    </Grid> 
</Grid> 

而後面的代碼:

private void Dialog_OnManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs args) 
{ 
    DialogTransform.TranslateX += args.Delta.Translation.X; 
    DialogTransform.TranslateY += args.Delta.Translation.Y; 
} 

然後你就可以建立一個像顯示/隱藏動畫,關閉按鈕等

+0

這偉大工程,更復雜的邏輯。現在有沒有辦法在包含的TextBox中取回我的選擇功能?我去選擇文本,而框會在顯示屏上移動。新使用OnManipulationDelta。 – Rick

+0

沒關係。我修正了這個問題: – Rick

+0

private void OnTextBoxMainipulation(object sender,Windows.UI.Xaml.Input.ManipulationDeltaRoutedEventArgs e) DialogTransform.TranslateX- = e.Delta.Translation.X; DialogTransform.TranslateY- = e.Delta.Translation.Y; } – Rick

相關問題