Question

These days I am working on a complex WPF application. So far it has been a good experience. But I am stuck on a point. Its a designer application and users drag custom controls on a canvas and set their properties. Currently users can specify the control's length in cm, in, px and pt. I need to give them the option of specifying control's length in millimeters.

I know of LengthConverter class in WPF but it does not give us the facility to use millimeters as unit. Why is that? Why would Microsoft not give the possibility of specifying lengths of controls in mm?

What are the workarounds to do so?

Was it helpful?

Solution

Wondering if this question was left unanswered because of the obvious answer...

If you can use cm as a size there is no problem.

Ask for the desired size in mm, divide by ten and you're there.

Why would Microsoft not give the possibility of specifying lengths of controls in mm?

Maybe because they don't feel it's necessary to add support for all multiples of 10? You might as well ask why they don't use micrometers, millimetres, decimetres, meters, decameters, hectometres, kilometres... because the conversion from cm is so easy.

To wit, they do use inch and pt even though there's an easy conversion factor of 72. But that 's not as obvious.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top