Table of Contents

Namespace VisioForge.Core.UI.WPF

Namespaces

VisioForge.Core.UI.WPF.Skins
VisioForge.Core.UI.WPF.VolumeMeterPro

Classes

LogDialog

A WPF dialog window that displays log messages and error information. This dialog provides a simple text-based view for capturing and displaying runtime errors, debug messages, and other logging information from the VisioForge media processing components.

MultiscreenVideoView

A WPF UserControl providing high-performance video rendering for multiscreen and multi-stream display scenarios.

This control is optimized for displaying multiple video streams simultaneously in WPF applications, such as surveillance systems, video walls, and multi-camera monitoring interfaces. It renders raw video frames directly to a WPF Image control using WriteableBitmap for efficient software-based video playback.

Key features:

  • Software-based RGB24 video frame rendering
  • Thread-safe frame processing with background operations
  • Automatic UI thread marshaling for safe WPF updates
  • Dynamic frame size adaptation without flickering
  • Native memory operations for optimal performance
  • Minimal overhead for multi-stream scenarios
  • Automatic aspect ratio handling

Architecture:

  • Uses WriteableBitmap for efficient pixel buffer updates
  • Employs native memcpy for high-speed frame data copying
  • Implements double-buffering pattern with _rendering flag
  • Dispatcher.BeginInvoke for thread-safe UI updates
  • Grid-based layout with Image control for display

Performance characteristics:

  • Native memory copy operations (memcpy) for maximum speed
  • Minimal GC pressure through reusable WriteableBitmap
  • Thread-safe frame queueing prevents UI blocking
  • Efficient handling of frame dimension changes
  • Optimized for multiple concurrent video streams

Common use cases:

  • Video surveillance dashboards with multiple camera feeds
  • Video conferencing applications with participant grids
  • Multi-camera video editing interfaces
  • Video wall displays
  • Split-screen video playback
  • Picture-in-picture implementations

Threading considerations:

  • Frame data can be pushed from any thread
  • Rendering operations are marshaled to UI thread automatically
  • _rendering flag prevents concurrent frame updates
  • Safe for high-frequency frame delivery

Memory management:

  • WriteableBitmap is reused when possible
  • Frame data is copied using unsafe native operations
  • Minimal managed allocations per frame
  • Automatic cleanup on control disposal

Technical notes:

  • Supports only RGB24/BGR24 pixel format
  • Handles line stride calculation for proper alignment
  • Uses 72 DPI for bitmap creation
  • Black background by default
VideoSurfaceFrameEventArgs

Per-frame payload for VisioForge.Core.UI.WPF.IVideoSurfaceProvider.FrameReady. Carries the DXGI shared handle and frame size; consumer code can open the handle on its own ID3D11Device to read or write the texture between Acquire/Release.

VideoView

High-performance video view control for WPF applications providing multiple rendering modes and comprehensive video display capabilities. Supports software rendering via WriteableBitmap, hardware-accelerated rendering via Direct2D/EVR, and native rendering for optimal performance. This control handles video frame display, UI event forwarding, background image management, status overlays, and video transformations.

Key features:

  • Multiple rendering modes: FrameCallback (software), Direct2D, EVR, MadVR, and native rendering
  • Hardware acceleration support for GPU decoding and high-resolution video (4K/8K)
  • Thread-safe frame delivery with efficient pixel format handling
  • Video rotation and transformation capabilities
  • Status overlay system for connection progress and custom notifications
  • Comprehensive mouse and keyboard event handling
  • Background image support with stretch modes
  • Picture-in-picture overlay functionality
  • DPI awareness for high-DPI displays
  • Memory-efficient frame buffering with automatic cleanup

Threading considerations:

  • Frame rendering is performed on the UI thread via Dispatcher.BeginInvoke for thread safety
  • All UI operations are properly marshaled to the UI thread
  • Event handlers are invoked on the UI thread
  • Native rendering components require proper disposal to prevent memory leaks
  • Window minimize/restore events are handled with proper synchronization to prevent race conditions

Performance optimizations:

  • WriteableBitmap reuse to minimize memory allocations
  • Efficient pixel format detection and stride calculation
  • Hardware-accelerated rendering paths for supported configurations
  • Frame dropping capability to maintain smooth playback
WPFImageHelper

Static utility class providing image format conversion between WinForms and WPF image types.

This helper class bridges the gap between System.Drawing.Bitmap (WinForms) and WPF's BitmapSource, enabling seamless image data exchange between different UI frameworks within the same application. Essential for mixed-mode applications using both WinForms and WPF components.

Key features:

  • Bidirectional conversion between Bitmap and BitmapSource
  • Proper native resource management with automatic cleanup
  • Performance-optimized conversion using native Windows APIs
  • Memory-safe operations with proper handle disposal
  • Support for various pixel formats and color depths

Performance characteristics:

  • Uses native GDI+ and WPF interop for optimal performance
  • Minimizes memory allocations through efficient resource handling
  • Proper disposal of native handles to prevent memory leaks
  • Optimized for frequent conversions in real-time applications

Thread safety: All methods are thread-safe and can be called from any thread. Native resource management ensures proper cleanup regardless of calling thread.

WPFUIHelper

Static utility class providing WPF visual tree manipulation and search functionality.

This helper class offers essential tools for navigating and manipulating the WPF visual tree, which is crucial for finding child controls, implementing custom behaviors, and performing runtime UI analysis. Particularly useful for control templating, theming, and dynamic UI scenarios.

Key features:

  • Recursive visual tree traversal with generic type filtering
  • Efficient enumeration of specific control types
  • Deep searching through complex visual hierarchies
  • Support for finding controls within templates and data templates
  • Performance-optimized iteration with yield return

Common use cases:

  • Finding specific controls within complex UI hierarchies
  • Implementing custom behaviors that need to locate child controls
  • Theming and styling operations that require control enumeration
  • Debugging and diagnostics for UI structure analysis
  • Dynamic UI generation requiring control discovery

Performance characteristics:

  • Uses yield return for memory-efficient iteration
  • Recursive traversal with early termination support
  • Minimal memory allocation during traversal
  • Optimized for both shallow and deep tree searches

Thread safety: All methods should be called from the UI thread as they manipulate WPF visual elements.

WPFWindowWrapper

Window handle wrapper enabling WinForms dialog display in WPF applications.

This class provides a bridge between WPF and WinForms by implementing the IWin32Window interface, allowing WinForms dialogs and controls to be properly parented to WPF windows. Essential for mixed-mode applications that need to display WinForms dialogs (like file dialogs, message boxes, or third-party controls) within a WPF application context.

Key features:

  • Implements IWin32Window interface for WinForms compatibility
  • Extracts native window handle from WPF windows
  • Provides proper parent-child relationship for dialogs
  • Ensures correct Z-order and focus behavior
  • Enables modal dialog functionality across UI frameworks

Common use cases:

  • Displaying WinForms dialogs from WPF applications
  • Embedding WinForms controls that require parent handles
  • Third-party component integration requiring Win32 handles
  • Legacy code integration in modernized WPF applications

Technical implementation:

  • Uses WindowInteropHelper to extract native window handle
  • Maintains handle reference for dialog lifetime
  • Provides seamless interop between WPF and WinForms

Thread safety: Should be created and used on the UI thread as it accesses WPF window handles.

WPFWindowWrapperHelper

Static helper class providing extension methods for seamless WinForms dialog integration in WPF applications.

This utility class extends WinForms Form objects with convenient extension methods that automatically handle the complexity of showing WinForms dialogs from WPF applications. It eliminates the need for manual window handle extraction and wrapper creation.

Key features:

  • Extension methods for natural API usage
  • Automatic window handle extraction and wrapper creation
  • Proper parent-child relationship establishment
  • Seamless integration between WPF and WinForms modal dialogs
  • Clean, fluent API that hides interop complexity

Benefits:

  • Simplified syntax for showing WinForms dialogs from WPF
  • Automatic resource management for window handles
  • Consistent modal dialog behavior across UI frameworks
  • Reduced boilerplate code for mixed-mode applications

Thread safety: Extension methods should be called from the UI thread as they access WPF window handles.

Interfaces

IVideoSurfaceProvider

Exposed by WPF VideoView when it runs in the VisioForge.Core.Types.VideoRendererMode.D3D11Composable mode. The provider owns a single BGRA8 D3D11 shared texture; its handle (VisioForge.Core.UI.WPF.IVideoSurfaceProvider.SharedTextureHandle) is stable for the lifetime of the current internal texture and may be reset to Zero on resize, device-removed / TDR, unsupported pixel format upstream, or disposal. See VisioForge.Core.UI.WPF.IVideoSurfaceProvider.SharedTextureHandle for the full list.