public Shell() { InitializeComponent(); Current = this; var background = new Image() { Source = new BitmapImage(new Uri("ms-appx:///Assets/Photos/Backgrounds/HERO.jpg")), Stretch = Windows.UI.Xaml.Media.Stretch.UniformToFill }; if (ApiInformation.IsTypePresent("Windows.UI.Xaml.Controls.ParallaxView")) { _parallaxView = new ParallaxView() { VerticalShift = 50, Child = background }; BackgroundBorder.Child = _parallaxView; } else { BackgroundBorder.Child = background; } }
private void ConditionalPage_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e) { if (Sdk.SupportsParallaxView) { // Insert ParallaxView. var parallax = new ParallaxView(); parallax.Source = ForegroundElement; parallax.VerticalShift = 100; Grid.SetColumn(parallax, 2); ContentGrid.Children.Remove(BeachImage); parallax.Child = BeachImage; ContentGrid.Children.Insert(0, parallax); } }
private void Page_Loaded(object sender, RoutedEventArgs e) { var background = new Image() { Source = new BitmapImage(new Uri("ms-appx:///Assets/Photos/reflection-849159_1920.jpg")), Stretch = Windows.UI.Xaml.Media.Stretch.UniformToFill }; if (ApiInformation.IsTypePresent("Windows.UI.Xaml.Controls.ParallaxView")) { var parallaxView = new ParallaxView() { Source = Scroller, VerticalShift = 50, Child = background }; BackgroundBorder.Child = parallaxView; } else { BackgroundBorder.Child = background; } }