Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set a Background image in UNO UWP?

I am trying to put a background image, so far I have this code:

<Grid.Background>
    <ImageBrush ImageSource="ms-appx:///Assets/Windows-10-Hero-Ninja-Cat-1024x576-03a71eed2a427425.jpg" Stretch="UniformToFill"/>
</Grid.Background>

Which appears this way on UWP on Windows 10:

UWP on Windows 10

But when I Build the WASM or Android, the Background image does not appear.

Edge

enter image description here

The file property is set Build action: Content, Copy to output directory: Do not copy.

enter image description here

like image 711
Tony Avatar asked Jul 07 '18 17:07

Tony


1 Answers

Uno's WASM target is still experimental and some features are not available yet. The only yet implemented background brush is SolidColorBrush.

It's implemented for iOS (source code here), but not Android.

Since you're already in a <Grid>, you can simply put your image as first element:

  <Grid>
    <Image Source="ms-appx:///Assets/Windows-10-Hero-Ninja-Cat-1024x576-03a71eed2a427425.jpg" Stretch="UniformToFill" />
    [... put your other controls here]
  </Grid>
like image 120
Carl de Billy Avatar answered Nov 06 '22 08:11

Carl de Billy