RedCorners.Forms.DelayedView is a special ContentView2 control that lets its Content load after the page is loaded.

It is useful when a control is performing a lot of performance-intensive actions on its initialization, and if used normally, would block the UI thread for a while. A notable example of this is Google Maps, especially when it is set to show the current location. The Google Maps control typically blocks the thread for a noticable time during initialization, in order to fetch the current GPS location of the device.

Therefore, using Google Maps normally, would block the UI thread:

<rfm:LocationPickerView MyLocationEnabled="True" />

In such cases, performance intensive controls can be put inside a DelayedView, in order to be initialized after everything in the page is initialized and rendered:

    <rfm:LocationPickerView MyLocationEnabled="True" />

DelayedView offers a temporary View to be shown while its actual Content is being initialized, through its LoadingView property. This way, you can show a loading animation or a mock version of the main view, in order to keep the application’s user interface look nicer:

            <rfm:LocationPickerView MyLocationEnabled="False" InputTransparent="True" />
            <ActivityIndicator HorizontalOptions="Center" VerticalOptions="Center" />

    <rfm:LocationPickerView MyLocationEnabled="True" />

Moreover, through the Delay property, you can assign a minimum guaranteed waiting time in milliseconds before DelayedView switches to the main Content.

You can also assign an arbitrary function to act as a Job to be completed by DelayedView asynchronously, before it switches to the main Content.

DelayedView starts its jobs when it has been assigned to a Parent, and its size has been allocated. This means after its OnParentSet and OnSizeAllocated methods have been called.

The status of the DelayedView can be checked via its IsLoading boolean readonly property.


bool IsLoading { get; }

This readonly property indicates whether the main Content has been loaded or not.

View LoadingView

This property overrides the temporary view shown when DelayedView is performing its tasks, prior to switching to the main Content.

int Delay

This property adjusts the minimum guaranteed waiting time (in milliseconds) before switching to the main Content.

[ContentProperty] View Content

This property contains the main View to be shown after the job is finished.

Func<object, Task> Job

This property lets you assign an arbitrary task to the DelayedView to be executed asynchronously during its loading stage. In case a Job is assigned, the loading will continue until the Job is finished.

object JobParameter

This bindable property lets you assign a parameter to the Job function.