-
Notifications
You must be signed in to change notification settings - Fork 47
UPF Modals
Ultraviolet Framework 1.3 added support for the creation of modal dialog boxes.
New modal dialogs must inherit from the Modal
abstract class found in the Ultraviolet.Presentation
namespace. Each modal is associated with an instance of UIScreen
; the screen's view defines the layout of the modal. The Modal
class requires that this screen be exposed by implementing the abstract Screen
property.
public partial class MyModal : Modal
{
public MyModal()
{
Screen = new MyModalScreen();
}
public override UIScreen Screen { get; }
}
Every modal has an associated value called its dialog result, which is set when the modal is closed. This value, exposed by the DialogResult
property of the modal instance, indicates whether the modal's operation completed successfully, failed, or was cancelled. You can specify a modal's dialog result by closing the modal using its Close()
method, usually from within the view model of the modal's screen.
A modal is opened using one of the ShowDialog()
or ShowDialogAsync()
static methods defined by the Modal
class. Use ShowDialogAsync()
when you need to respond to the dialog result; it will return a ModalTask<Boolean?>
which will complete when the dialog is closed.
Modal.ShowDialogAsync(myModalInstance).ContinueWith(result =>
{
// handle dialog result
});
If you use ShowDialog()
, no ModalTask
is returned, and your code will not be able to respond to the modal's dialog result.
- Contributing
- Dependencies
- Basic Concepts
- First Look- Platform
- First Look- Graphics
- First Look- Audio
- First Look- Input
- First Look- Content
- First Look- UI
- sRGB Color
- Customizing SpriteBatch
- Creating Fonts
- Creating Effects
- Creating Glyph Shaders
- FreeType2 Fonts
- Rendering 3D Models