
๐ Quick Navigation
| Section | Description |
|---|---|
| ๐ผ Screenshots | Visual examples and use cases |
| ๐ Features | Complete feature list |
| ๐ How to Use | Quick start guide |
| โก Performance | Performance optimizations (v2.2+) |
| ๐๏ธ Architecture | Service-based design |
| ๐ Documentation | Complete documentation index |
| ๐งช Testing | Unit tests and quality |
| ๐ง Frameworks | .NET support |
Wpf Hexeditor is a powerful and fully customisable user control for editing file or stream as hexadecimal, decimal and binary.
You can use it very easily in Wpf or WinForm application. Download the code and test the Wpf (C#, VB.NET) and WinForm (C#) samples.
The control are localized in English, French, Russian, Polish, Portuguese and Chinese
โญ You want to say thank or just like project ?
Hexeditor control is totaly free and can be used in all project you want like open source and commercial applications. I make it in my free time and a few colaborators help me when they canโฆ Please hit the โญ๏ธ button or fork and I will be very happy ;) I accept help contributionโฆ
๐ผ Screenshots
|
๐ Standard ASCII View Clean interface with hex/ASCII side-by-side
|
๐ฎ Custom TBL (Final Fantasy II) Game ROM editing with custom character tables
|
|
๐ Find & Replace Advanced search with pattern matching
|
๐ BarChart View โญ Visual data representation for analysis
|
๐ง Advanced Features - Click to see more screenshots
|
โ๏ธ ByteShift + Fixed Table Editing Advanced table editing with byte shifting
|
๐ฅ๏ธ AvalonDock Integration โญ Dockable panels for complex workflows
|
|
๐จ Custom Background Blocks Visual diff and data highlighting
|
|
๐งพ What is TBL (custom character table)
The TBL are small plaintext .tbl files that link every hexadecimal value with a character, which proves most useful when reading and changing text data. Wpf HexEditor support .tbl and you can define your custom character table as you want.
Unicode TBL are supported. For use put value at the right of equal (=) like this (0401=ๅก่ฅฟๅฐ) or (42=ะ) in you plaintext .tbl file.

๐ Complete Feature List
| โญ = New in v2.2+ | ๐ = Performance feature |
๐ Core Editing
- Multi-format editing: Hexadecimal, Decimal, Binary display modes
- Multi-byte support: 8-bit, 16-bit, 32-bit editing
- Endianness: LoHi (Little Endian) or HiLo (Big Endian)
- Insert/Delete bytes: Full support with automatic length adjustments
- Append bytes: Add bytes at end of file
- Fill selection: Fill with specific byte value
- Unlimited Undo/Redo: Full history with memory optimization
- Read-only mode: View-only mode for safe browsing
๐ Search & Navigation
- Advanced search: FindFirst, FindNext, FindPrevious, FindLast, FindAll
- Pattern search: Search for byte patterns (byte[] or string)
- Replace operations: ReplaceFirst, ReplaceNext, ReplaceAll
- ๐ Search caching: 100-1000x faster repeated searches
- Highlight results: Auto-highlight search matches
- Bookmarks: Mark important positions with descriptions
- Go to offset: Jump directly to byte position
- Selection highlighting: Visual selection feedback
๐ Copy/Paste & Export
- Standard clipboard: CTRL+C, CTRL+V, CTRL+X support
- Copy as code: Export as C#, VB.NET, C, Java, F#, Python code
- Multiple formats: HexString, ASCIIString, Binary, Decimal
- Copy to stream: Export selection to Stream or file
- Custom copy modes: Configurable default export format
๐จ Display & Visualization
- โญ BarChart view: Visual data representation
- โญ AvalonDock support: Dockable hex editor panels
- Byte grouping: Group bytes in blocks of 2, 4, 6, 8, 16 bytes
- ๐ Multiple encodings: ASCII, UTF-8, UTF-16 (LE/BE), UTF-32, Latin-1, and custom encodings via
Encoding.GetEncoding() - Custom TBL support: Use .tbl character tables (game ROMs, translation hacking)
- Unicode TBL: Support for Unicode character mapping in TBL files
- Zoom: 50% to 200% content scaling
- Show deleted bytes: Option to visualize deleted data
- Line addressing: Show/hide byte addresses
- Offset modes: Decimal or hexadecimal addressing
- Scrollbar markers: Visual markers for search results, bookmarks, changes
โก Performance & Optimization
- ๐ UI Virtualization: Handle GB-sized files (80-90% memory reduction)
- ๐ Render caching: 5-10x faster UI rendering
- ๐ Width calculation cache: 10-100x faster cell width calculations
- ๐ Search result caching: 460x speedup for repeated searches
- ๐ Span<T> APIs: Zero-allocation operations (.NET 5.0+)
- ๐ SIMD search: Hardware-accelerated search (AVX2/SSE2)
- ๐ Async operations: Non-blocking I/O for large files
- ๐ Memory-mapped files: Support files larger than RAM
๐จ Customization & Theming
- Color customization: Bytes, TBL, backgrounds, headers, selection
- Custom backgrounds: Highlight byte ranges with colors and descriptions
- Font customization: Choose any font family and size
- Border styles: Customize visual appearance
- Status bar: Configurable position, selection, file info display
- Context menus: Fully customizable right-click menus
๐๏ธ Architecture & Services
- Service-based design: 10 specialized services for clean separation
- ByteProvider: Efficient data access layer
- Stream support: Work with any Stream (MemoryStream, FileStream, custom)
- Event system: DataCopied, SelectionChanged, ByteModified, etc.
- Change tracking: Track all modifications with position info
๐งช Developer Features
- HexBox control: Standalone hex input control with spinner
- Dependency properties: Full WPF binding support
- MVVM compatible: Works with MVVM pattern
- Sample applications: 7+ working samples (C#, VB.NET, WinForms)
- Unit tests: 275+ tests with 100% service coverage
- Benchmarks: BenchmarkDotNet suite for performance testing
- Localization: English, French, Russian, Polish, Portuguese, Chinese
๐ File Format Support
- Any binary file: No format restrictions
- Large files: Tested with multi-GB files
- Partial loading: Load only visible portions (AllowVisualByteAddress)
- Stream editing: Edit without loading entire file into memory
- Custom formats: Use TBL files for custom character encoding
โจ๏ธ Keyboard Shortcuts
- CTRL+C / CTRL+V / CTRL+X: Copy/Paste/Cut
- CTRL+Z / CTRL+Y: Undo/Redo
- CTRL+A: Select All
- CTRL+F: Find dialog
- CTRL+H: Replace dialog
- CTRL+G: Go to offset
- CTRL+B: Toggle bookmark
- ESC: Clear selection
- Delete / Backspace: Delete selected bytes
- Arrow keys: Navigation
- Page Up/Down: Fast scrolling
๐ See Performance Guide for detailed optimization documentation
โก Performance Optimizations (v2.2+)
๐ For detailed performance documentation, benchmarking results, and best practices, see the Performance Guide
Advanced Backend Optimizations:
- ๐ LRU Cache for Search Results (Option 4)
- 10-100x faster for repeated searches
- Intelligent caching with automatic eviction of least recently used results
- Thread-safe with O(1) lookup performance
- Configurable capacity (default: 20 cached searches)
- โก Parallel Multi-Core Search (Option 5)
- 2-4x faster for large files (> 100MB)
- Automatic threshold detection (uses all CPU cores for large files)
- Zero overhead for small files (automatic fallback to standard search)
- Thread-safe with overlap handling for patterns spanning chunk boundaries
- ๐ฏ Profile-Guided Optimization (PGO) (Option 6)
- 10-30% performance boost for CPU-intensive operations (.NET 8.0+)
- Dynamic runtime optimization with tiered compilation
- 30-50% faster startup with ReadyToRun (AOT compilation)
- Automatic in Release builds
- ๐ SIMD Vectorization (net5.0+)
- 4-8x faster single-byte searches with AVX2/SSE2
- Processes 32 bytes at once with AVX2 (16 with SSE2)
- Automatic hardware detection and fallback
- **๐ฆ Span
+ ArrayPool** - 2-5x faster with 90% less memory allocation
- Zero-allocation memory operations
- Buffer pooling for efficient resource usage
- โฑ๏ธ Async/Await Support
- 100% UI responsiveness during long operations
- Progress reporting (0-100%) with IProgress
- Cancellation support with CancellationToken
Combined Results:
- 10-100x faster operations (depending on optimization tier)
- 95% less memory allocation
- 100% backward compatible - no breaking changes
- Automatic selection - optimizations activate based on file size/hardware
UI Rendering Optimizations (NEW!):
- ๐จ Cached Typeface & FormattedText (BaseByte.cs)
- 2-3x faster rendering by reusing expensive WPF objects
- Intelligent cache invalidation (only when text/font changes)
- Eliminates allocations on every OnRender() call
- ๐ Cached Width Calculations (HexByte.cs)
- 10-100x faster width lookups with static Dictionary cache
- O(1) lookups instead of repeated calculations
- Thread-safe with lock protection
- โก Batch Visual Updates (BaseByte.cs)
- 2-5x faster for multiple property changes
- BeginUpdate/EndUpdate pattern prevents redundant updates
- Single UpdateVisual() call instead of multiple
- ๐พ Optimized StringByte Rendering
- 2-3x faster by caching width calculations
- No re-computation on every render unless text changes
- Optimized for both TBL and ASCII modes
UI Performance Gains:
- 5-10x faster UI operations overall
- 50-80% reduction in rendering allocations
- 100% backward compatible - no API changes
- Automatic - optimizations always active
Data Structure Optimizations (NEW v2.2+):
- โจ HighlightService HashSet Migration
- 2-3x faster highlight operations with HashSet vs Dictionary
- 50% less memory usage (single long vs key-value pair)
- Single lookup operations (no redundant ContainsKey checks)
- ๐ฆ Batching Support for Bulk Operations
- 10-100x faster when highlighting thousands of search results
- BeginBatch/EndBatch pattern prevents UI updates during operations
- Real-world: 1000 highlights in ~100ฮผs instead of 1.2ms
- ๐ Bulk APIs
- AddHighLightRanges() - 14x faster than loops (5-10x typical)
- AddHighLightPositions() - 27x faster for scattered positions
- Auto-batching when not already in batch mode
Highlight Performance Gains:
- 10-100x faster bulk highlighting (with batching)
- 2-3x faster single operations
- 50% less memory for highlight tracking
- 100% backward compatible - same API, better performance
See PERFORMANCE_GUIDE.md for comprehensive documentation.
๐ How to use
Add a reference to WPFHexaEditor.dll from your project, then add the following namespace to your XAML:
xmlns:control="clr-namespace:WpfHexaEditor;assembly=WPFHexaEditor"
Insert the control like this in your XAMLโฆ:
<control:HexEditor/>
<control:HexEditor Width="NaN" Height="NaN"/>
<control:HexEditor Width="Auto" Height="Auto"/>
<control:HexEditor FileName="{Binding FileNamePath}" Width="Auto" Height="Auto"/>
๐๏ธ Architecture
WPF HexEditor now uses a modern service-based architecture for improved maintainability and testability.
Service Layer (10 Services)
The control is powered by specialized services that handle different aspects of functionality:
Core Services
- ๐ ClipboardService - Manages copy/paste/cut operations
- ๐ FindReplaceService - Search and replace with LRU cache + parallel search (10-100x faster)
- โฉ๏ธ UndoRedoService - Undo/redo history management
- ๐ฏ SelectionService - Selection validation and manipulation
- โจ HighlightService - Manages byte highlighting with HashSet + batching (10-100x faster bulk operations)
- ๐ง ByteModificationService - Handles insert, delete, and modify operations
Additional Services
- ๐ BookmarkService - Bookmark management and navigation
- ๐ TblService - Custom character table (TBL) operations
- ๐ PositionService - Position calculations and conversions
- ๐จ CustomBackgroundService - Custom background color blocks
Benefits:
- โ Separation of concerns - Each service has a single responsibility
- โ Unit testable components - Services can be tested in isolation
- โ Reusable across projects - Services are decoupled from HexEditor
- โ Easier to maintain and extend - Clear APIs and focused logic
- โ No breaking changes - Public API preserved during refactoring
Statistics:
- 10 services total (6 stateless, 4 stateful)
- ~150+ public methods
- ~2500+ lines of business logic extracted
See Services Documentation for details.
๐ Documentation
๐ Table of Contents
- Getting Started - Quick integration guide
- Architecture - Service-based design overview
- Performance Guide - โก Performance optimization, benchmarking, best practices
- API Reference - HexEditor control documentation
- Sample Applications - Working examples
- Core Components - Internal architecture
- Testing - Unit tests and quality assurance
๐ฏ Main Control API
WPFHexaEditor Control - Complete documentation for the main HexEditor control
- Control architecture with 10 services
- Property reference and customization
- Usage examples (basic and advanced)
- Performance optimization tips
- Multi-targeting support (.NET 4.8 / .NET 8.0)
- Internationalization (6 languages)
๐ Architecture & Design
Architecture Diagrams - Visual architecture documentation
- Service layer architecture (Mermaid diagrams)
- Data flow diagrams
- Component relationships
- Design patterns used
Services Layer - Business logic architecture
- Complete API reference for all 10 services
- Service usage examples and patterns
- Stateless vs stateful services
- Integration guidelines
๐จ Sample Applications
Samples Overview - All sample applications
Individual Samples:
- C# WPF Sample - Main comprehensive demo
- VB.NET Sample - Visual Basic version
- WinForms Sample - Windows Forms integration
- AvalonDock Sample - Professional IDE-like interface
- BarChart Sample - Visual data analysis
- Binary Diff Sample - File comparison
- Insert Anywhere Sample - Dynamic insertion/deletion
- Service Usage Sample - Console app using services without UI
๐งฉ Core Components
Core Overview - Core infrastructure documentation
Detailed Component Documentation:
- Bytes/ - ByteProvider and byte manipulation
- File/stream I/O with modification tracking
- Insert/delete/modify operations
- Undo/redo support
- Conversion utilities
- CharacterTable/ - TBL file support
- Custom character encoding for game hacking
- Multi-byte character support (DTE)
- Bidirectional byte โ character mapping
- Converters/ - WPF value converters
- Hex/decimal conversions
- Visibility converters
- Path/filename converters
- EventArguments/ - Custom event args
- ByteEventArgs for modifications
- ByteDifferenceEventArgs for comparisons
- CustomBackgroundBlockEventArgs for highlighting
- Interfaces/ - Core interfaces
- IByte - Byte control contract
- IByteControl - Manipulation interface
- IByteModified - Change tracking contract
- MethodExtention/ - Extension methods
- Byte array extensions
- String parsing helpers
- Double formatting
- Application helpers
- Native/ - Windows API P/Invoke
- High-performance file I/O
- Memory-mapped files
- Native window operations
- Dialog/ - UI dialogs
- Find window
- Find/Replace window
- Byte input dialogs
๐งช Testing & Quality
Unit Tests - Test suite documentation
- 80+ unit tests with xUnit
- Service layer test coverage
- Test patterns and best practices
- Running tests and CI/CD integration
๐ง Development Tools
ByteProviderBench - Performance benchmarking tool
- Read/write performance testing
- Memory usage profiling
- Search algorithm benchmarks
๐ Project Structure
Sources Overview - Complete source code structure
- Directory organization
- Build instructions
- Multi-targeting configuration
๐ง Supported Frameworks
- โ .NET Framework 4.8
- โ .NET 8.0-windows
๐งช Unit Testing
The project includes comprehensive unit tests for all service layer components:
- Test Framework: xUnit with .NET 8.0-windows
- Test Project:
WPFHexaEditor.Tests - Coverage: 80+ tests across 3 test suites
SelectionServiceTests- 35 tests for selection operationsFindReplaceServiceTests- 35 tests for search/replace with cachingHighlightServiceTests- 10+ tests for highlight management
Running tests:
cd Sources/WPFHexaEditor.Tests
dotnet test
The service-based architecture makes unit testing straightforward - services can be tested in isolation without UI dependencies.
๐ Recent Bug Fixes
Critical Fix (2026):
- Fixed search cache not being invalidated after data modifications
- Users now receive accurate search results after editing
- Cache properly cleared at all 11 modification points
๐บ๏ธ Complete Documentation Map
Every major folder in the project contains comprehensive README documentation:
๐ฆ WpfHexEditorControl/
โ
โโโ ๐ README.md (this file) ..................... Main project overview
โโโ ๐ ARCHITECTURE.md .......................... Architecture diagrams
โ
โโโ ๐ Sources/
โ โโโ ๐ README.md ............................ Source code overview
โ โ
โ โโโ ๐ WPFHexaEditor/
โ โ โโโ ๐ README.md ........................ Main control documentation
โ โ โ
โ โ โโโ ๐ Services/
โ โ โ โโโ ๐ README.md .................... 10 services API reference
โ โ โ
โ โ โโโ ๐ Core/
โ โ โ โโโ ๐ README.md .................... Core components overview
โ โ โ โโโ ๐ Bytes/README.md .............. ByteProvider & data layer
โ โ โ โโโ ๐ CharacterTable/README.md ..... TBL file support
โ โ โ โโโ ๐ Converters/README.md ......... WPF value converters
โ โ โ โโโ ๐ EventArguments/README.md ..... Custom event args
โ โ โ โโโ ๐ Interfaces/README.md ......... Core interfaces
โ โ โ โโโ ๐ MethodExtention/README.md .... Extension methods
โ โ โ โโโ ๐ Native/README.md ............. Windows API P/Invoke
โ โ โ
โ โ โโโ ๐ Dialog/
โ โ โโโ ๐ README.md .................... Find/Replace dialogs
โ โ
โ โโโ ๐ WPFHexaEditor.Tests/
โ โ โโโ ๐ README.md ........................ 80+ unit tests
โ โ
โ โโโ ๐ Samples/
โ โ โโโ ๐ README.md ........................ Samples overview
โ โ โโโ ๐ WPFHexEditor.Sample.CSharp/README.md
โ โ โโโ ๐ WpfHexEditor.Sample.VB/README.md
โ โ โโโ ๐ WpfHexEditor.Sample.Winform/README.md
โ โ โโโ ๐ WpfHexEditor.Sample.AvalonDock/README.md
โ โ โโโ ๐ WpfHexEditor.Sample.BarChart/README.md
โ โ โโโ ๐ WpfHexEditor.Sample.BinaryFilesDifference/README.md
โ โ โโโ ๐ WpfHexEditor.Sample.InsertByteAnywhere/README.md
โ โ โโโ ๐ WpfHexEditor.Sample.ServiceUsage/README.md
โ โ
โ โโโ ๐ Tools/
โ โโโ ๐ ByteProviderBench/
โ โโโ ๐ README.md .................... Performance benchmarking
Total Documentation: 19 comprehensive README files covering every aspect of the project! ๐
๐ก Learning Path
Beginner: Start here
- Read How to Use for basic integration
- Explore C# Sample for practical examples
- Review Main Control API for available properties
Intermediate: Dive deeper
- Understand Architecture and service layer design
- Study Services Documentation for advanced features
- Try specialized samples (BarChart, Binary Diff)
Advanced: Master the internals
- Explore Core Components architecture
- Review ByteProvider for data layer understanding
- Study Unit Tests for testing patterns
- Build custom tools with Service Usage Sample
๐ค Contributing
We welcome contributions! The comprehensive documentation makes it easy to understand the codebase:
- All services are documented with API references
- Unit tests provide usage examples
- Architecture diagrams show component relationships
- Each folder has detailed README with examples
โจ WPF HexEditor - A powerful, well-documented hex editor control for .NET
Created by Derek Tremblay (derektremblay666@gmail.com) Contributors: ehsan69h, Janus Tida, Claude Sonnet 4.5
Coded with โค๏ธ for the community! ๐๐ค