1

是否可以创建一个包含带有 uri 源的 web 视图的弹出元素(例如http://www.youtube.com/embed/z-m6Ua9Iqkg)?单击按钮后如何在屏幕中央显示一个弹出窗口?

1)是的,我搜索了互联网,但我不知道如何将网页视图元素放在弹出窗口中,因为点击后它只显示空白的白色矩形(5x10)。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

1

最后,我有这个(问题解决了,感谢来自 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(); 
于 2013-05-16T04:52:43.117 回答