๐Ÿš€ 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
  1. Open WpfHexEditorControl.sln in Visual Studio 2022
  2. Set WpfHexEditor.App as the startup project
  3. 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-platform whfmt.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

IDENotes
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);
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)

ShortcutAction
Ctrl+CCopy selection
Ctrl+VPaste
Ctrl+XCut
Ctrl+ZUndo
Ctrl+YRedo
Ctrl+FQuick search (inline bar)
Ctrl+Shift+FAdvanced search dialog
Ctrl+GGo to offset
Ctrl+ASelect all
F3 / Shift+F3Find next / previous
InsToggle Insert / Overwrite mode
Ctrl+MouseWheelZoom
ESCClose 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