When Background is set on elements like Page or ContentControl, the background is not actually shown in WebAssembly.
Background brush should be reflected in app.
Create a Page and set its Background to Blue. Run on WASM and observe the background is still default white.
Nuget Package: -
Package Version(s): master branch
Affected platform(s):
Visual Studio
Relevant plugins
If I were to guess, I'd say that's because Page has no default style, and that it uses the implicit ContentControl behavior. Adding the default one will probably fix it.
If I were to guess, I'd say that's because
Pagehas no default style, and that it uses the implicitContentControlbehavior. Adding the default one will probably fix it.
You mean adding a default style? I am confused why it works on Android and iOS and not on WASM.
Also I was looking here - I am a bit confused about why the property works differently than others, could you please give me some background (pun intended) on this?
The default style for ContentControl may be different on Wasm, this will be addressed by the styles update.
And as Page has no default style, it relies on that default behavior. Try adding one.
@jeromelaban I am not sure if the default style applies here - the problem is not that the background is not set, but rather that it is not applied on Page. The same problem is on Android and iOS - value of Background is not applied. This is the right behavior for UserControl, etc., but in case of Page the background should be applied to match UWP.
This issue is most likely fixed by https://github.com/unoplatform/uno/issues/1674
/cc @davidjohnoliver
This is not a styling related issue - it's expected that a Page will not have a style, like all UserControl-derived types. It's also normal that an unstyled Control (such as ContentControl) won't show its Background, but Page is a special case where the background is rendered directly on the control.
@MartinZikmund are you aware of any controls other than Page where the background is shown on UWP but not Uno? If not I'd propose we close out this issue in favour of https://github.com/unoplatform/uno/issues/2210.
@davidjohnoliver I think it is relevant only for Page, other things like UserControl etc. don't apply it in UWP either.
@davidjohnoliver It seems the background is not applied to Page at least on Android, haven't tested the others yet.
The issue really is only Page, which has its very own specific behavior regarding the Background property. It's the only UserControl that displays its own Background.