Tip: iOS blur rectangles

I spent several hours trying to get blur rectangles to work, per the tutorial, without luck (and there’s no downloadable project):


I was trying to get the effect to apply when the screen opened, so I had this code in the Opening event:

BaseRectangle.FillColor = Color.Clear

BlurRectangle.SetEffect(MobileRectangle.BlurStyles.MaterialLight, MobileRectangle.VibrancyStyles.Fill)

No matter how I tweaked things, the effect would not show up.

When I added the code to the screen’s Resized event, it finally worked.

The code to set the effect will not work in the Activated event either.

Hope this helps someone.
XOJO 2022 R2


If I recall correctly I usually had this in the Activated event:

Timer.CallLater(1, weakAddressOf delayedLayout)

The method delayedLayout would then use the setEffect. I think I read this here in the forum a few years back.