2017-10-13 98 views
2

我需要在UWP應用程序中顯示全屏對話框(在應用程序窗口邊界中),但似乎無法使其工作。我試着用:UWP顯示全屏彈出式對話框,內容對話框或彈出式菜單

  • ContentDialog只有FullSizeDesired =「真」

  • 彈出窗口顯示垂直拉伸,甚至試圖設置在其背後的不工作

  • 彈出按鈕放置代碼的寬度和高度=「Full」只能像contentdialog那樣垂直拉伸它

不敢相信我花那麼多時間在那個東西上:(

感謝

回答

0

你有沒有嘗試過這樣的事情:

var c = Window.Current.Bounds; 
var g = new Grid 
{ 
    Width = c.Width, 
    Height = c.Height, 
    Background = new SolidColorBrush(Color.FromArgb(0x20, 0, 0, 0)), 
    Children = 
    { 
     new Rectangle 
     { 
      Width = 100, 
      Height = 100, 
      Fill = new SolidColorBrush(Colors.White), 
      Stroke = new SolidColorBrush(Colors.Black), 
      StrokeThickness = 3 
     } 
    } 
}; 
var p = new Popup 
{ 
    HorizontalOffset = 0, 
    VerticalOffset = 0, 
    Width = c.Width, 
    Height = c.Height, 
    Child = g 
}; 

p.IsOpen = true; // open when ready 

你應該可以看到一個半透明的疊加,在你的屏幕中間的白色矩形。