Show image in Full screen

前端 未结 2 412
暗喜
暗喜 2021-01-16 14:58

I am working on Windows Phone 8 app and have a Image view like this in XAML:



        
2条回答
  •  自闭症患者
    2021-01-16 15:49

    An alternative approach, without passing the image details between pages, is to display a Popup:

    private void HandleTapImage(object sender, GestureEventArgs e)
    {
        var myPopup = new Popup
        {
            Child = new Image
            {
                Source = ((Image) sender).Source,
                Stretch = Stretch.UniformToFill,
                Height = Application.Current.Host.Content.ActualHeight,
                Width = Application.Current.Host.Content.ActualWidth
            }
        };
        myPopup.IsOpen = true; 
    }
    

    (Select Strech value best suited for your needs). With this approach however you have to manually hide ApplicationBar and SystemTray, if present, in the HandleTapImage method. You also have to take care of hiding the Popup and showing the bars again.

提交回复
热议问题