ParallaxView suddenly no longer supports direct content

The current release of the XAML Controls Gallery app is compiled against Preview 4 of Project Reunion. Against that specific version the ParallaxView control works fine. The example source code for this control is:

<ParallaxView Source="{Binding ElementName=listView}" VerticalShift="500">

    <Image Source="ms-appx:///Assets/SampleMedia/cliff.jpg" />

</ParallaxView>


However, looking at this against the release version of Reunion 0.5 it suddenly throws a warning up in the XAML viewer:

The type 'ParallaxView' does not support direct content.

and the line <Image Source="ms-appx:///Assets/SampleMedia/cliff.jpg" /> has a wavy line under it.

I couldn't find any readily available examples that say what to do about this, but the answer is to provide this C# code.

Image splash = new Image();
splash.Source = new BitmapImage(new Uri("ms-appx:///Assets/SampleMedia/cliff.jpg"));
splash.Stretch = Stretch.UniformToFill;
splash.VerticalAlignment = VerticalAlignment.Center;
parallaxView.Child = splash;

Comments

  1. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. You can use the ParallaxView.Child in XAML property for content.

      Delete

Post a Comment

Popular posts from this blog

Setting a colour from a StaticResource in C#

Resource Strings - UWP vs net 5