I want to create my own value mapper, similar to ColorMapper. It's not very difficult, but I want make my mapper not dependent on exact data type. So I want to utilize methods already present in ValueMapper class, such as GetDoubleValue(), FindTargetElement(), SetTargetValue() etc. But wait, I can't, because they are marked as internal instead of protected. So i must copy them to my mapper (or reinvent wheel - come up with my own code, very similar to code already present in ValueMapper class).
Can somebody tell me, why these methods are internal instead of (virtual) protected ?
Hello,
As many other things the XamTreeMap’s mapping is created internal, so that it cannot be modified. This ensures the main functionality’s programming logic will not fail and in this particular situation will ensure to our customers the correct behavior for color, radial, double and groupvalue mapping. If you want to create your own mapper you can inherit the ValueMapper class as described in the following article: http://help.infragistics.com/NetAdvantage/WPFDV/2010.3/CLR4.0/?page=xamTreemap_Custom_Value_Mappers.html . On the other hand if you do not want to come up with your own logic for implementing this, you can download the source code from our website and copy the approach from there.
Please let me know if you require any further clarification on the matter.
IMHO OOP is designed for creating extensible behaviors. One of original purpose of OOP was code reuse. And you are just denying this by your implementation.
Can you explain me the way, how can descendant of ValueMapper class break your code if GetDoubleValue(), FindTargetElement(), SetTargetValue(), etc will be protected instead of internal?
I can always copy your code. And I did, because there is no other way how to use your internal methods. But this is unnecessary code duplication.