NuExt.Presentation.Wpf is a lightweight, WPF-focused presentation library providing XAML helpers, control extensions, data-binding utilities, diagnostics, and templating helpers. It enables clean, reusable presentation code across WPF applications with minimal dependencies.
- Control extensions —
TreeViewItemHelper,ComboBoxExtensions,VirtualizingStackPanelExtensions, andControlExtensionsprovide common WPF control operations. - Binding helpers —
BindingProxyandBindingProxy<T>expose binding sources across resource dictionaries, templates, and locations outside the normalDataContextinheritance chain. - Framework extensions —
FrameworkElementExtensions,DependencyObjectExtensions,WindowExtensionsfor element and window operations. - Visual and logical tree traversal — find visual children and parents, or resolve an ancestor through the visual tree with a logical-tree fallback.
- Dispatcher-safe access — read dependency properties and execute property accessors on the owning WPF dispatcher.
- Window placement —
WindowPlacementto save/restore window position, size, and state with minimal code. - Diagnostics —
BindingErrorTraceListenercaptures and displays WPF binding errors when data-binding tracing is enabled. - Templating —
ComboBoxItemTemplateSelectorand reusable XAML styles (TreeViewItem, etc.). - Minimal dependencies — depends only on
NuExt.Systemand WPF framework assemblies.
WPF on .NET 8/9/10 and .NET Framework 4.6.2+. The library is independent of any particular MVVM framework.
<Window.Resources>
<local:BindingProxy x:Key="proxy" DataContext="{Binding}" />
</Window.Resources>
<Button Content="Actions">
<Button.ContextMenu>
<ContextMenu DataContext="{Binding Source={StaticResource proxy}, Path=DataContext}">
<MenuItem Header="Refresh" Command="{Binding RefreshCommand}" />
</ContextMenu>
</Button.ContextMenu>
</Button>protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
PresentationTraceSources.Refresh();
PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Warning;
PresentationTraceSources.DataBindingSource.Listeners.Add(new BindingErrorTraceListener());
}var placement = WindowPlacement.GetPlacement(windowHandle);
// ... later, restore
WindowPlacement.SetPlacement(windowHandle, placement);var treeView = ...;
var item = treeView.GetTreeViewItem(myDataItem);
if (item != null) item.IsSelected = true;- Reusable — common presentation infrastructure shared across WPF applications.
- Minimal — focused APIs without an application framework or MVVM architecture dependency.
- Explicit — straightforward extensions and helpers with visible WPF behavior.
- Debuggable — built-in binding diagnostics and readable implementation paths.
Via NuGet:
dotnet add package NuExt.Presentation.WpfOr via Visual Studio:
- Go to
Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution.... - Search for
NuExt.Presentation.Wpf. - Click "Install".
- NuExt.Minimal.Behaviors.Wpf
- NuExt.Minimal.Mvvm.SourceGenerator
- NuExt.Minimal.Mvvm.Wpf
- NuExt.Minimal.Mvvm.MahApps.Metro
- NuExt.System
- NuExt.System.Data
- NuExt.System.Data.SQLite
Issues and PRs are welcome. Keep changes minimal and performance-conscious.
MIT. See LICENSE.