Expand description
§windows-reactor
Windows Reactor is a declarative WinUI 3 library for Rust. A Component owns state, receives
parent-owned input, handles typed messages, and returns a View. Reactor reconciles each new view
with the native UI tree and applies the required WinUI changes.
Add Reactor:
[dependencies]
windows-reactor = "0.100"This counter shows the Component/View model:
use windows_reactor::*;
struct Counter {
count: u32,
}
impl Component for Counter {
type Input = ();
type Message = ();
fn create(_input: &(), _context: &ComponentContext<Self>) -> Self {
Self { count: 0 }
}
fn update(&mut self, _message: (), _context: &ComponentContext<Self>) {
self.count += 1;
}
fn view(&self, _input: &(), context: &mut ViewContext<Self>) -> View {
StackPanel::new().spacing(8.0).children((
TextBlock::new().text(format!("Count: {}", self.count)),
Button::new()
.on_click(context.forward())
.content("Increment"),
))
}
}
fn main() {
App::run_component::<Counter>(()).unwrap();
}Structs§
- App
- Starts and owns a Reactor application’s WinUI message loop.
- AppBar
Button - AppBar
Separator - Auto
Suggest Box - Bitmap
Icon - Border
- Breadcrumb
Bar - Button
- Calendar
Date Picker - Calendar
View - Callback
- A clonable callback used by Reactor events.
- Cancellation
Token - A cooperative cancellation signal passed to background work.
- Canvas
- Check
Box - Color
- An 8-bit-per-channel ARGB color.
- Color
Picker - Combo
Box - Command
Bar - Command
BarFlyout - Primary and secondary commands displayed in a command-bar flyout.
- Component
Context - Capabilities available while creating or updating a component.
- Component
Task - A handle for observing or cancelling background work.
- Content
Dialog - Context
- A typed context channel with a fallback value.
- Corner
Radius - Four corner radii measured in device-independent pixels (DIPs).
- Date
Picker - Date
Time - Drag
Drop Action - Drag
Drop Policy - Drop
Down Button - Dropped
Storage Item - Effect
Key - Identifies an effect within one component publication.
- Element
Observation - Keeps an
ElementRefobservation registered. - Element
Ref - A stable typed reference to a published native element.
- Ellipse
- Encoded
Image - Immutable encoded bitmap data for an
ImageorImageIconsource. - Exit
Transition - A fade applied while an element is removed from the native tree.
- Expander
- Flip
View - Flyout
- Text or view content displayed in a flyout.
- Font
Icon - Font
Weight - An OpenType font weight in the inclusive range 1 through 999.
- Grid
- Grid
View - Grid
View Item - Hyperlink
Button - Image
- Image
Icon - Info
Badge - InfoBar
- Items
Repeater - Key
- Stable identity for a keyed child, menu item, tree node, or command.
- KeyAccelerator
- A keyboard accelerator and its callback.
- KeyAccelerators
- A set of keyboard accelerators assigned to a control.
- Keyed
View - A view paired with stable reconciliation identity.
- Line
- ListBox
- List
BoxItem - List
View - List
View Item - Local
Sender - Sends typed messages to a component’s queued update loop.
- Menu
- A context menu whose click callback receives the selected item’s label.
- MenuBar
- Menu
BarItem - Navigation
View - Navigation
View Item - Number
Box - Password
Box - Path
Icon - Person
Picture - Pivot
- Pivot
Item - Pointer
Event Info - Pointer state in element-local and window-relative device-independent pixels.
- Progress
Bar - Progress
Ring - Radio
Button - Radio
Buttons - Rating
Control - Rectangle
- Relative
Panel - Repeat
Button - Resource
Overrides - Theme resource values applied to a control subtree.
- Rich
Edit Box - Rich
Text - Paragraph content for a
RichTextBlock. - Rich
Text Block - Rich
Text Hyperlink - A hyperlink with display text and a target URI.
- Rich
Text Paragraph - A paragraph of rich-text inline values.
- Rich
Text Run - A text run with optional bold and italic styling.
- Scroll
View - Scroll
Viewer - Selector
Bar - Selector
BarItem - Slider
- Slot
View - Content assigned to one typed control slot.
- Split
Button - Split
View - Stack
Panel - Swap
Chain Panel - Symbol
Icon - TabView
- TabView
Item - Teaching
Tip - Text
Block - TextBox
- Thickness
- Four edge values measured in device-independent pixels (DIPs).
- Time
Picker - Time
Span - Title
Bar - Toggle
Button - Toggle
Switch - Tooltip
- Text or view content displayed as a tooltip.
- Tree
Node - A keyed node in a tree view.
- Tree
View - Variable
Sized Wrap Grid - View
- A declarative Reactor subtree.
- View
Context - Records view-time declarations for a component publication.
- Viewbox
- Virtual
Source - A lazily materialized, keyed source for a virtualizing control.
- WebView2
- Window
Constraints - Optional window client-size limits in device-independent pixels (DIPs).
- Window
Ref - A token-bound capability for a component’s owning window.
- Window
Size - Window client dimensions in device-independent pixels (DIPs).
- Window
Visuals - Window appearance and client sizing requested by a component publication.
Enums§
- Accelerator
Key - A key supported by Reactor keyboard accelerators.
- Accelerator
Modifiers - Modifier keys for a keyboard accelerator.
- AppBar
Button Slot - Auto
Suggest BoxSlot - Automation
Heading Level - Brush
- A theme resource brush or a fixed solid color.
- Button
Style - Calendar
Date Picker Slot - Color
Scheme - Whether the active application color scheme is light or dark.
- Combo
BoxSlot - Command
BarCommand - A keyed command owned by a command bar or command-bar flyout.
- Command
BarSlot - Component
Task Status - The delivery state of a component background task.
- Composition
Host Event - Layout and compositor events from a composition host.
- Content
Dialog Result - Date
Picker Slot - Drag
Drop Operation - Drag
Kind - Dropped
Data - Expander
Slot - Flip
View Slot - Flyout
Placement - Placement of a flyout relative to its target.
- Grid
Length - A Grid row or column size.
- Grid
View Slot - Horizontal
Alignment - Horizontal placement within the space assigned by a parent.
- Info
BarSeverity - Integration
Error - Failure reported by an asynchronous native integration request.
- List
BoxSlot - List
View Selection Mode - List
View Slot - Menu
BarSlot - Menu
Item - A keyed item in a context menu.
- Navigation
View Back Button Visible - Navigation
View Display Mode - Navigation
View Item Slot - Navigation
View Pane Display Mode - Navigation
View Slot - Number
BoxSlot - Orientation
- Password
BoxSlot - Password
Reveal Mode - Pivot
Slot - Pump
Diagnostic - Radio
Buttons Slot - Resource
Value - A supported WinUI resource override value.
- Rich
Edit BoxSlot - Rich
Text Inline - An inline run, hyperlink, or line break in rich text.
- Scroll
BarVisibility - Scrolling
Scroll BarVisibility - Selector
BarItem Slot - Selector
BarSlot - Slider
Slot - Split
View Display Mode - Split
View Slot - Stretch
- Swap
Chain Panel Event - Rendering and layout events from a swap-chain panel.
- Symbol
- TabView
Slot - Teaching
TipPlacement Mode - Text
BoxSlot - Text
Trimming - Text
Wrapping - Theme
Brush - A brush resolved from the active WinUI theme resources.
- Time
Picker Slot - Title
BarSlot - Toggle
Switch Slot - Tooltip
Placement - Placement of a tooltip relative to its target.
- Tree
View Selection Mode - Vertical
Alignment - Vertical placement within the space assigned by a parent.
- Viewbox
Slot - Window
Backdrop - Material used behind a window’s content.
- Window
Theme - The theme requested for a window.
- Window
Title BarHeight - Height preset for an extended window title bar.
Traits§
- Automation
Ext - Adds UI Automation metadata to a native control.
- Canvas
Child Ext - Places a concrete native control in its parent Canvas.
- Children
Control - Assigns children to a native container.
- Command
BarFlyout Ext - Adds a command-bar flyout to a view.
- Component
- A stateful unit that turns input and queued messages into a
View. - Content
Control - Assigns one content view to a native content control.
- Flyout
Ext - Adds a flyout to a view.
- Focus
Control - Marks generated controls that accept programmatic focus.
- Grid
Child Ext - Places a concrete native control in its parent Grid.
- Into
Payload Callback - Converts a payload handler or typed message callback into an event callback.
- Into
Unit Callback - Converts a zero-argument handler or typed message callback into an event callback.
- Into
Views - Converts a statically shaped expression into positional views.
- Layout
Control - Applies layout, opacity, margin, and exit-transition properties to native controls.
- MenuExt
- Adds a context menu to a view.
- Reference
Control - A native control that can be bound to an
ElementRef. - Relative
Panel Child Ext - Places a concrete native control in its parent RelativePanel.
- Slots
Control - Assigns single views or keyed collections to a control’s typed slots.
- Tooltip
Ext - Adds a tooltip to a view.
- Tree
View Ext - Supplies a keyed node hierarchy to a tree view.
Type Aliases§
- Composition
Host Error - Errors from composition-host requests.
- Focus
Error - Errors from focus requests.
- Image
Source Error - Errors from image-source requests.
- Swap
Chain Panel Error - Errors from swap-chain panel requests.
- WebView2
Error - Errors from WebView2 integration requests.