-
Notifications
You must be signed in to change notification settings - Fork 47
Getting Started with UPF
The Ultraviolet Presentation Foundation (UPF) is a view provider for the Ultraviolet UI subsystem which is modeled after the Windows Presentation Foundation (WPF), a popular framework from Microsoft for designing Windows applications. UPF is considered a part of the Ultraviolet Framework, but not a core component. It must therefore be explicitly added to your application and configured before it can be used.
The Presentation Foundation is available on NuGet through the Ultraviolet.Presentation
package. Installing this package will add a reference to the Ultraviolet.Presentation.dll
assembly to your project.
As of the 2018.04 release, UPF can be configured using Ultraviolet's new plugin architecture. In OnCreatingUltravioletContext()
, add an instance of the Ultraviolet.Presentation.PresentationFoundationPlugin
class to the Plugins
collection exposed by the configuration object.
Prior to that release, UPF must be configured by calling the Configure()
method on the Ultraviolet.Presentation.PresentationFoundation
static type and passing in the configuration object as an argument.
As described in the article on UPF binding expressions, the C# code fragments which bind your UPF views to their view models need to be compiled before they can be used. Another NuGet package, Ultraviolet.Presentation.Compiler
, contains the Roslyn-based expression compiler which performs this task for you. If this package is not included in your project, then attempting to compile binding expressions will throw an exception at runtime.
There are two sample projects which demonstrate how to define UPF views and include them in an application: Sample 12 - UPF and Sample 13 - UPF (Advanced). The code for these samples can be found in the Samples
folder of the Ultraviolet repository.
- 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