I'm trying to create custom ValueEditor and it seems like the Value property of editor always contains my value as a string. This ValueEditor is supposed to accept some enum and basing on its value change cell's color (simply display a rectangle with appropriate background).
I'm setting ValueType of my editor in several ways, e.g.:
in static constructor:
ValueTypeProperty.OverrideMetadata(
typeof(StatusEditor), new FrameworkPropertyMetadata(typeof(ExecutionResultStatus)));
in editor style:
<Setter Property="ValueType" Value="{x:Type DataModel:ExecutionResultStatus
}" />
but it seems that my editor always transforms my enumeration into a string.
I'm using my editor in UnboundField with Binding property set. Any ideas? Maybe you have a complete example of custom ValueEditor? (except one which I've already found called HostAnyControl, I want to have completely custom editor for my purpose, not some general editor which can host any WPF control).
Hello,
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
Hi Stefan,
Thank you for your response.
I've created a sample project and attached it to this post. The issue can be easily seen in PriorityConverter class. Looking forward for any ideas how to solve it.
It looks like I've located the problem: I had to assign appropriate type to DataType property of the Field class. After it had been done, I was getting values of desired type in my custom ValueEditor. Marking this issue as solved...
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.