๐ Getting Started with WpfHexEditor
April 16, 2026 ยท View on GitHub
Two ways to use this project: run the full IDE or embed the HexEditor control in your own WPF app.
Option A โ Run the IDE
The fastest way to explore the project.
Requirements: Visual Studio 2022 ยท .NET 8.0 SDK ยท Windows
git clone https://github.com/abbaye/WpfHexEditorIDE.git
- Open
WpfHexEditorControl.slnin Visual Studio 2022 - Set
WpfHexEditor.Appas the startup project - Press F5
The IDE launches with VS-style docking. You can:
- File โ New Solution โ create a project with binary, TBL, JSON, or text files
- File โ Open โ open any binary file directly in a new tab
- Drag panels to float, dock, or auto-hide
- Switch themes via View โ Theme
Option B โ Embed the HexEditor in Your WPF App
Step 1 โ Reference the V2 Projects
In your .csproj:
<ItemGroup>
<ProjectReference Include="..\WpfHexEditor.Core\WpfHexEditor.Core.csproj" />
<ProjectReference Include="..\WpfHexEditor.HexEditor\WpfHexEditor.HexEditor.csproj" />
</ItemGroup>
NuGet: All major controls are available on NuGet โ
WPFHexaEditor,WpfCodeEditor,WpfDocking,WpfColorPicker,WpfTerminal, and the cross-platformwhfmt.FileFormatCatalog(690+ format definitions). See the main README for install commands.
Step 2 โ Add the Namespace
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hex="clr-namespace:WpfHexEditor.HexEditor;assembly=WpfHexEditor.HexEditor"
Title="My App" Height="600" Width="900">
Step 3 โ Add the Control
<Grid>
<hex:HexEditor x:Name="HexEdit" />
</Grid>
Step 4 โ Open a File
HexEdit.FileName = @"C:\path\to\file.bin";
// or
HexEdit.OpenFile(@"C:\path\to\file.bin");
// or from stream
HexEdit.Stream = File.OpenRead(@"C:\path\to\file.bin");
Done! You now have a fully functional hex editor. ๐
IDE Support
| IDE | Notes |
|---|---|
| Visual Studio 2022 | โ Full toolbox, XAML designer, SmartComplete |
| JetBrains Rider | โ XAML SmartComplete + preview โ no visual toolbox (Rider limitation) ยท See Rider Guide |
| VS Code | โ XAML extension for syntax highlighting |
Common API Usage
Read & Write Bytes
// Read
byte value = HexEdit.GetByte(0x100);
byte[] data = HexEdit.GetBytes(0x100, 16);
byte[] selection = HexEdit.SelectionByteArray;
// Write
HexEdit.SetByte(0x100, 0xFF);
HexEdit.InsertByte(0x100, 0xAB);
HexEdit.DeleteByte(0x100, 10);
Search
long pos = HexEdit.FindFirst(new byte[] { 0x4D, 0x5A }); // MZ header
var all = HexEdit.FindAll(new byte[] { 0xFF, 0xFF });
await HexEdit.FindFirstAsync(bytes, progress, cancellationToken);
Save
HexEdit.SubmitChanges(); // Save to original file
HexEdit.SubmitChanges(@"C:\output.bin"); // Save As
if (HexEdit.HasChanges) { ... }
Customization
<hex:HexEditor Background="#1E1E1E"
Foreground="White"
SelectionFirstColor="#264F78"
ByteModifiedColor="Orange"
FontFamily="Consolas"
BytePerLine="16" />
TBL Character Tables
HexEdit.LoadTBL(@"C:\game-charset.tbl");
HexEdit.TypeOfCharacterTable = CharacterTableType.ASCII;
HexEdit.CustomEncoding = Encoding.GetEncoding("shift-jis");
Bookmarks
HexEdit.SetBookmark(HexEdit.SelectionStart);
HexEdit.GotoNextBookmark();
HexEdit.GotoPreviousBookmark();
HexEdit.ClearAllBookmarks();
Copy as Code
string code = HexEdit.GetCopyData(CopyPasteMode.CSharpCode);
// โ byte[] data = { 0x4D, 0x5A, 0x90, 0x00 };
// Other modes: VBNetCode, JavaCode, PythonCode, ...
Custom Background Highlighting
HexEdit.AddCustomBackgroundBlock(new CustomBackgroundBlock
{
StartOffset = 0x100,
Length = 256,
Color = Colors.LightBlue,
Description = "Header"
});
Keyboard Shortcuts (HexEditor Control)
| Shortcut | Action |
|---|---|
| Ctrl+C | Copy selection |
| Ctrl+V | Paste |
| Ctrl+X | Cut |
| Ctrl+Z | Undo |
| Ctrl+Y | Redo |
| Ctrl+F | Quick search (inline bar) |
| Ctrl+Shift+F | Advanced search dialog |
| Ctrl+G | Go to offset |
| Ctrl+A | Select all |
| F3 / Shift+F3 | Find next / previous |
| Ins | Toggle Insert / Overwrite mode |
| Ctrl+MouseWheel | Zoom |
| ESC | Close search bar / clear selection |
Events
HexEdit.SelectionStartChanged += (s, e) => { /* ... */ };
HexEdit.SelectionLengthChanged += (s, e) => { /* ... */ };
HexEdit.ByteModified += (s, e) => { /* offset: e.BytePositionInStream */ };
HexEdit.LongProcessProgressChanged += (s, e) => { progressBar.Value = e.Percent; };
Next Steps
- FEATURES.md โ complete feature list (IDE, editors, panels, controls)
- CHANGELOG.md โ what's new in each version
- Architecture Guide โ MVVM + service design
- API Reference โ full API documentation
- CONTRIBUTING.md โ how to contribute