bevy_pf 0.2.8

A XAML / WPF-like UI framework for Bevy: XAML in macros or files, styling with resources, and the common WPF control set.
docs.rs failed to build bevy_pf-0.2.8
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: bevy_pf-0.2.6

bevy_pf

A XAML / WPF-like UI framework for Bevy. Write UI in XAML — inline via xaml!{} or in .xaml files — and instantiate it as bevy_ui entities.

bevy_pf = "0.1"
use bevy::prelude::*;
use bevy_pf::prelude::*;

fn main() {
    App::new()
        .add_plugins((DefaultPlugins, PfUiPlugin))
        .add_systems(Startup, setup)
        .run();
}

fn setup(mut commands: Commands) {
    commands.spawn(Camera2d);
    commands.spawn_xaml(xaml!(
        r#"<StackPanel xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                       Margin="24" Spacing="8">
             <TextBlock Text="Hello from XAML" FontSize="28" FontWeight="Bold"/>
             <Button x:Name="Go" Content="Click me" Width="140"/>
           </StackPanel>"#
    ));
}

What is here

WPF's panels (Grid with star/auto/pixel tracks, StackPanel, WrapPanel, Canvas, DockPanel, Border, ScrollViewer), 40+ controls from Button to DataGrid, TreeView, ComboBox, Menu/ContextMenu and DatePicker, plus ecosystem equivalents (ToggleSwitch, NumericUpDown, RatingBar, NavigationView, toasts, dialogs, and vector-drawn icons that need no icon font).

Around them: resources and styles (StaticResource, DynamicResource, implicit styles, BasedOn, merged dictionaries), ControlTemplate re-templating with {TemplateBinding} and triggers, data binding against any #[derive(Reflect)] view-model, storyboard animation, and WPF's verbatim dependency-property precedence tiers.

Element identity survives the trip: x:Name becomes a queryable ECS component, so ordinary Bevy systems and observers work on XAML-declared UI.

Conformance

WPF is treated as the specification. docs/wpf-conformance-notes.md in the repository audits behavior against the dotnet/wpf reference source and records every accepted deviation with its reason — including hit testing, where a null Background on a panel is transparent to input exactly as in WPF.

Features

  • clipboard (default) — system clipboard for text inputs. Android consumers should take default-features = false; the underlying crate has no Android backend and fails to compile there.
  • native_shapes (default) — draw solid <Rectangle> and square <Ellipse> elements in Bevy's existing UI pass, with no raster texture or extra camera. Unsupported shapes fall through to tiny-skia.
  • hot_reload — watch .xaml assets and re-instantiate on change.
  • vector_gpu — route shape rendering through bevy_pf_vector (tessellate once, draw instanced) after native shapes claim their supported subset, with the CPU path kept as fallback.

License

MIT OR Apache-2.0, at your option.