Crosslight Dialog Presenter allows you to present a dialog and receive additional input from users. Unlike other Crosslight presenter variations such as Message Presenter which provides only simple and basic interaction, dialog presenter lets you present any custom content that may contain additional input controls and more sophisticated UI logic bound to a ViewModel. Similar to the other presenter variants, you can easily consume dialog presenter right from the ViewModel.

Using Dialog Presenter

Using dialog presenter is simple and straightforward. You can target virtually any type of view context by specifying the respective ViewModel. To learn more how to implement the platform-specific view, see Data Presentation Overview.

Here are some basic usage examples. To show a simple dialog and retrieve the result, you can use the following code snippet:

Customizing Dialog Presenter

Dialog Presenter comes with 3 built-in buttons which represents negative, positive, and neutral actions. By default, the dialog presenter will only display the positive and neutral buttons. However you can easily customize what are going to be displayed through the DialogOptions. See the following code.

If you wish to hide the buttons, you can do it in this way.

There are several properties that you can customize in the DialogOptions. See the following list.

TitleSpecifies the caption text of the dialog.

ButtonsSpecifies the visible buttons.

HideButtonsIndicates whether buttons should be included in the

NegativeButtonTextSpecifies the negative button text.

NegativeButtonStyleSpecifies the negative button style.

PositiveButtonTextSpecifies the positive button text.

PositiveButtonStyleSpecifies the positive button style.

NeutralButtonTextSpecifies the neutral button text.

NeutralButtonStyleSpecifies the neutral button style.

Platform-specific Settings

In addition to the generic dialog settings, each platform has their own settings that are specific to their interface guidelines. For instance, you can enable universal presenter setting in iOS, customizing its transition, presentation mode, and much more.