I've got a WPF IMultiValueConverter that I am forced to make stateful (for ConvertBack functionality). This requires me to mark all uses of it as x:Shared="False"
in XAML. I'm not happy with this approach but I for my particular problem, I have yet to find a better alternative.
In the interests of aiding future developers on this codebase, I would like to write some checking code-behind that will at at least dump a debug warning message to them they have used the converter but failed to mark it as x:Shared="False"
.
Is there way for me, in code-behind of my converter, to retrieve the value of "x:Shared" attribute that someone has marked in XAML?
Edit to clarify: I want to be sure that when the user declares an instance of my converter in the resource section, that they do this:
<core:LengthToValueConverter x:Key="MyConverter" x:Shared="False"/>
and not just this:
<core:LengthToValueConverter x:Key="MyConverter"/>
(In case anyone wants to know why I'm doing this, I'm performing unit conversion much as described in this thread and am facing the same ConvertBack issue that the poster did. I welcome better alterative approaches. )