building-mewui-apps
Minimal App
using MewUI;
using MewUI.Controls;
var window = new Window()
.Title("My App")
.Width(800).Height(600)
.Content(new Label().Text("Hello, MewUI!"));
Application.Run(window); // Static method
Application Setup
// Set defaults BEFORE Run()
Application.DefaultGraphicsBackend = GraphicsBackend.Direct2D; // or Gdi, OpenGL
var window = new Window().Title("My App").Content(mainContent);
Application.Run(window);
// Access current app AFTER Run() starts
// Application.Current.SetTheme(ThemeVariant.Light);
Common Controls
new Label().Text("Display text").BindText(observable)
new TextBox().BindText(observable).Placeholder("Hint")
new Button().Content("Click").OnClick(() => DoAction())
new CheckBox().Text("Option").BindIsChecked(observable) // Note: .Text() not .Content()
new ComboBox().Items("A", "B", "C").BindSelectedIndex(observable)
new ListBox().Items("X", "Y", "Z").BindSelectedIndex(observable)
new Slider().Minimum(0).Maximum(100).BindValue(observable)
new ProgressBar().Minimum(0).Maximum(100).BindValue(observable)
new Image().SourceFile("path.png").StretchMode(ImageStretch.Uniform) // Note: SourceFile, StretchMode
Theming
// Access theme in controls
var bg = Theme.Palette.ControlBackground;
var accent = Theme.Palette.Accent; // Note: Accent, not AccentColor
var radius = Theme.Metrics.ControlCornerRadius;
// Visual states
var color = _isPressed ? Theme.Palette.ButtonPressedBackground
: IsMouseOver ? Theme.Palette.ButtonHoverBackground
: Theme.Palette.ButtonFace;
// Theme change notification - note two parameters
protected override void OnThemeChanged(Theme oldTheme, Theme newTheme)
{
base.OnThemeChanged(oldTheme, newTheme);
InvalidateVisual();
}
Fluent Styling
element
.Width(200).Height(100)
.Margin(8).Padding(4)
.Background(Colors.White).Foreground(Colors.Black)
.HorizontalAlignment(HorizontalAlignment.Center)
.VerticalAlignment(VerticalAlignment.Stretch)
App Layout Pattern
new DockPanel().Children(
CreateMenu().DockTo(Dock.Top), // Note: .DockTo() not .Dock()
CreateToolbar().DockTop(), // Or convenience methods
CreateStatusBar().DockBottom(),
CreateSidebar().DockLeft().Width(200),
CreateMainContent() // Fills remaining
)
Dialogs & Popups: See dialogs.md Window management: See windows.md
More from christian289/dotnet-with-claudecode
converting-html-css-to-wpf-xaml
Converts HTML/CSS to WPF CustomControl XAML with correct patterns and common pitfall solutions. Use when transforming web designs to WPF, converting CSS animations to Storyboards, implementing CSS border-radius clipping, CSS pseudo-elements (::before/::after), or CSS transforms in XAML.
56publishing-wpf-apps
Guides WPF application publishing and installer options. Use when user mentions publish, deploy, release, packaging, or installer to help choose deployment method and installer technology.
14using-avalonia-collectionview
Provides CollectionView alternatives for AvaloniaUI using DataGridCollectionView and ReactiveUI. Use when filtering, sorting, or grouping collections in AvaloniaUI applications.
9designing-avalonia-customcontrol-architecture
Defines the basic solution structure for AvaloniaUI Desktop Applications using CustomControl. Use when creating new AvaloniaUI projects or designing stand-alone control styles with ControlTheme.
9using-xaml-property-element-syntax
Converts long inline XAML bindings to Property Element Syntax for better readability. Use when XAML binding expressions become too long or complex.
8managing-styles-resourcedictionary
Manages WPF Style definitions and ResourceDictionary patterns including BasedOn inheritance and resource merging. Use when building theme systems, organizing resources, or choosing between StaticResource and DynamicResource.
8