Skip to content

About

Lightweight WPF presentation infrastructure with control extensions, binding helpers, diagnostics, templating utilities, and window placement support.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

NuExt.Presentation.Wpf

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.

NuGet Ask DeepWiki Build License Downloads

Highlights

  • Control extensions — TreeViewItemHelper, ComboBoxExtensions, VirtualizingStackPanelExtensions, and ControlExtensions provide common WPF control operations.
  • Binding helpers — BindingProxy and BindingProxy<T> expose binding sources across resource dictionaries, templates, and locations outside the normal DataContext inheritance chain.
  • Framework extensions — FrameworkElementExtensions, DependencyObjectExtensions, WindowExtensions for 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 — WindowPlacement to save/restore window position, size, and state with minimal code.
  • Diagnostics — BindingErrorTraceListener captures and displays WPF binding errors when data-binding tracing is enabled.
  • Templating — ComboBoxItemTemplateSelector and reusable XAML styles (TreeViewItem, etc.).
  • Minimal dependencies — depends only on NuExt.System and WPF framework assemblies.

Compatibility

WPF on .NET 8/9/10 and .NET Framework 4.6.2+. The library is independent of any particular MVVM framework.

Quick Start

Binding outside the DataContext inheritance chain

<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>

Enable binding error diagnostics

protected override void OnStartup(StartupEventArgs e)
{
    base.OnStartup(e);
    PresentationTraceSources.Refresh();
    PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Warning;
    PresentationTraceSources.DataBindingSource.Listeners.Add(new BindingErrorTraceListener());
}

Save/restore window placement

var placement = WindowPlacement.GetPlacement(windowHandle);
// ... later, restore
WindowPlacement.SetPlacement(windowHandle, placement);

Find TreeViewItem by data item

var treeView = ...;
var item = treeView.GetTreeViewItem(myDataItem);
if (item != null) item.IsSelected = true;

Why NuExt.Presentation.Wpf?

  • 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.

Installation

Via NuGet:

dotnet add package NuExt.Presentation.Wpf

Or via Visual Studio:

  1. Go to Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution....
  2. Search for NuExt.Presentation.Wpf.
  3. Click "Install".

Ecosystem

Contributing

Issues and PRs are welcome. Keep changes minimal and performance-conscious.

License

MIT. See LICENSE.

About

Lightweight WPF presentation infrastructure with control extensions, binding helpers, diagnostics, templating utilities, and window placement support.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages