Build with XuiView Markdown

Application, window, and view

Follow one frame from application startup to the screen. The useful boundary is simple: your app creates views; a runtime supplies the native window, input, and drawing context.

Application starts the experience

The starter's Application derives from Xui.Core.Abstract.Application. Its Start() method calls CreateAndShowMainWindowOnce<MainWindow>(), an extension from Xui.Core.DI. The host registers both types before running the application.

Start() is the place to choose the first window. Avoid doing slow network or disk work there: the user should see a window before your app waits for remote data.

Window owns a view tree

MainWindow derives from Xui.Core.Abstract.Window. Its constructor accepts the scoped IServiceProvider, passes it to the base constructor, sets Title, and assigns Content.

The window creates a RootView. That root connects the window to its content, performs input routing, manages focus, and hosts overlays. Most application code does not need to create a RootView itself.

For example, this is a constructor-body fragment in a window whose base constructor has already run:

Title = "Field notes";
Content = new Xui.Core.UI.Label
{
    Text = "The window is ready.",
    FontFamily = "Inter",
    FontSize = 20,
    Margin = 24
};

Window.Content is an initialization property. To change destinations later, use a navigation host or update RootView.Content; do not recreate the native window for every page.

Views describe layout and behavior

A View can measure itself, arrange children, draw, and receive input. A VerticalStack arranges child views; a Label measures and draws text; a ToolKit Button turns pointer interaction into an action. Composition builds the screen from these small responsibilities.

Each view belongs to one parent at a time. Return a fresh, unattached view from a page factory. Sharing your data model is useful; sharing the same live view between two parents is not a supported way to share a page.

Runtime supplies the platform

The application resolves Xui.Core.Actual.IRuntime from its services. The runtime creates an Actual window for the Abstract window and provides the run loop and dispatcher. Native events enter the Abstract window, then reach the root and target views. Rendering travels in the other direction through a Canvas context supplied by the runtime.

The emulator and DevTools can wrap that boundary. Your page still uses Core and ToolKit APIs, so it does not need separate #if MACOS or #if BROWSER branches for ordinary layout or clicks.

Build something visible next in Build your first page.