How to add video to Grid.Background in UWP app?
In previous version, I used
<Grid.Background>
<ImageBrush ImageSource="ms-appx:///Assets/carosel3.jpg" Stretch="UniformToFill"/>
</Grid.Background>
How to add video to Grid.Background in UWP app?
In previous version, I used
<Grid.Background>
<ImageBrush ImageSource="ms-appx:///Assets/carosel3.jpg" Stretch="UniformToFill"/>
</Grid.Background>
Copyright © 2021 Jogjafile Inc.
There are two ways how to accomplish this in UWP.
Composition APIs
The Composition APIs offer
CompositionSurfaceBrushwith which you can paint an area with pixels rendered using a video throughMediaPlayer. Example from the documentation:Check the docs for more information on look for one of many tutorials on using Composition APIs on the internet (like here).
Separate `MediaPlayer element
A simpler solution would be to just place a
MediaPlayerElementunder theGriditself. When theGridhasTransparentbackground, the video will appear below theGrid.