1

URI ソース (たとえばhttp://www.youtube.com/embed/z-m6Ua9Iqkg )を含む Web ビューを含むポップアップ要素を作成することは可能ですか? ボタンをクリックした後、画面の中央にポップアップ ウィンドウを表示するにはどうすればよいですか?

1) はい、インターネットを検索しましたが、クリックすると空白の白い四角形 (5x10) しか表示されないため、Web ビュー要素をポップアップに配置する方法がわかりません。2) フライアウト カリプソを使用し、再び空白の白い四角形 (5x10) のみを表示します。

        Flyout flyOut = new Flyout();
        flyOut.PlacementTarget = sender as UIElement;
        flyOut.Placement = PlacementMode.Top;

        WebView web = new WebView();
        web.HorizontalAlignment=HorizontalAlignment.Center;
        web.VerticalAlignment = VerticalAlignment.Center;
        string html = "http://www.youtube.com/embed/z-m6Ua9Iqkg";

        flyOut.Content = web;
        web.NavigateToString(html);
        flyOut.IsOpen = true;

        UpdateLayout();

最後に、私はこれを持っています (MSDN の Sachin S のおかげで問題は解決しました)。

Popup popup = new Popup();

        Grid panel = new Grid();

        panel.Height = 250;
        panel.Width = 250;

        panel.Transitions = new TransitionCollection();
        panel.Transitions.Add(new PopupThemeTransition());
        WebView web = new WebView();
        //web.HorizontalAlignment = HorizontalAlignment.Center;
        //web.VerticalAlignment = VerticalAlignment.Center;
        web.Navigate(item.PlayerUri);
        popup.Child = panel;
        panel.Children.Add(web);
        popup.HorizontalAlignment = HorizontalAlignment.Center;
        popup.VerticalAlignment = VerticalAlignment.Center;


        popup.HorizontalOffset = (Window.Current.Bounds.Width / 2 - panel.Width / 2);
        popup.VerticalOffset = (Window.Current.Bounds.Height / 2 - panel.Height / 2);

        popup.IsOpen = true;
        UpdateLayout(); 
4

1 に答える 1