Wpf Hexeditor is a powerful and fully customisable user control for editing file or stream as hexadecimal, decimal and binary. Can be used in Wpf or WinForm application
When binding changes the property, the value is then internally set to a explicit value and the binding gets detached - which makes it impossible to be changed again. You can see what happens in the trace log - the binding changes property from default false to true, after which it is detached.
This worked fine until WpfHexEditor version 2.1.3 and seems to be broken since then.
This can also be verified when using Scoop to debug the control.
To Reproduce
I have created a simple test application, since your showcase does not use bindings.
Build can be found in the releases alongside with the test files.
Steps to reproduce the behavior:
Open the test application.
Click on Open file button
Select A or B text file
Try changing bytes
Click on the Read only button
Try changing bytes, you cannot
Click on the Read only button again
You still can't change bytes, even though read only mode is disabled
If you are compiling the test application yourself, you can see the trace log in the output when debugging.
You can also try to change editor version to 2.1.3 and try the same test, this will work as expected.
Expected behavior
It should be possible to control ReadOnlyMode of the editor trough one-way binding.
Remarks
From what I can tell, you are changing property values from inside the control using SetValue that replaces the value with a new one.
But in this case, should probably be using SetCurrentValue method that changes the effective value of the property, but keeps existing triggers, data bindings, and styles so they will continue to work.
Describe the bug There is a problem when changing value of ReadOnlyMode property trough one-way binding like this:
When binding changes the property, the value is then internally set to a explicit value and the binding gets detached - which makes it impossible to be changed again. You can see what happens in the trace log - the binding changes property from default false to true, after which it is detached.
This worked fine until WpfHexEditor version 2.1.3 and seems to be broken since then.
This can also be verified when using Scoop to debug the control.
To Reproduce I have created a simple test application, since your showcase does not use bindings. Build can be found in the releases alongside with the test files.
Steps to reproduce the behavior:
If you are compiling the test application yourself, you can see the trace log in the output when debugging. You can also try to change editor version to 2.1.3 and try the same test, this will work as expected.
Expected behavior It should be possible to control ReadOnlyMode of the editor trough one-way binding.
Remarks From what I can tell, you are changing property values from inside the control using SetValue that replaces the value with a new one. But in this case, should probably be using SetCurrentValue method that changes the effective value of the property, but keeps existing triggers, data bindings, and styles so they will continue to work.
More about this can be found in this blog post.
I suspect there will be more problems like this with other properties that are been changed from inside of the control.
Configuration