Expand description
§WinRT-XAML
A Rust library for creating UIs using WinRT and XAML.
This library provides a safe, idiomatic Rust interface to Windows Runtime (WinRT) XAML APIs, enabling the creation of modern Windows applications with XAML-based UIs.
§Features
- Application Management: Easy application lifecycle management
- Window Management: Create and manage windows with XAML content
- XAML Controls: Rich set of UI controls (Button, TextBlock, TextBox, etc.)
- Layout Panels: Flexible layout system (StackPanel, Grid, Canvas)
- Event Handling: Type-safe event subscription and handling
- Data Binding: Reactive data binding support
- XAML Parsing: Runtime and compile-time XAML parsing
- Compile-Time XAML:
xaml!macro for zero-cost abstractions - Styling: Resource dictionaries and style management
§Example
use winrt_xaml::prelude::*;
fn main() -> Result<()> {
let app = Application::new()?;
let window = Window::new()?
.title("My XAML App")
.size(800, 600);
let button = Button::new()
.content("Click Me!")
.on_click(|_| {
println!("Button clicked!");
});
window.set_content(button)?;
app.run()
}§XAML Islands
For desktop (Win32) applications, this library uses XAML Islands to host
XAML content within traditional windows. Enable the xaml-islands feature
(enabled by default) to use this functionality.
Modules§
- app
- Application management and message loop.
- controls
- UI controls using Win32 APIs.
- error
- Error types for WinRT-XAML.
- events
- Event handling system.
- layout
- Layout panels and containers using manual layout calculations.
- media
- Media types (colors, brushes, etc.) using Win32 GDI.
- prelude
- Prelude module for convenient imports
- reactive
- Reactive state management and data binding. Reactive state management for WinRT-XAML applications.
- resources
- Resource management and dictionaries.
- window
- Window management using Win32 APIs.
- winrt
- Windows Runtime (WinRT) infrastructure for XAML bindings.
- xaml_
islands - XAML Islands - Host UWP XAML in Win32 windows.
- xaml_
native - Safe Rust wrappers for XAML Islands via C++ helper DLL.
Macros§
- xaml
- Compile-time XAML parsing macro.
Type Aliases§
- Result
- Re-export of the Result type with our Error