Windowscommunitytoolkit: Use cm/in in printhelper

Created on 27 Jun 2017  路  5Comments  路  Source: windows-toolkit/WindowsCommunityToolkit

Hi,

I don't know if this is the right place, is there a way to convert width/height in XAML controls to cm/in and vice versa? for example if I need to print a square of 10cm, how can I know the value to put in the XAML? thanks!

kind regards

feature helpers in progress

All 5 comments

@emiliano84 I think you can easily create a converter that will automatically convert a cm value to a pixel value.

I assume you want to create a printable page where all controls (containers) are based on cm/in and not pixel. Here is a possible solution :

<Page Width="{x:Bind CmToPixel(21)}" Height="{x:Bind CmToPixel(29.7)}">
    ...
</Page>

@Odonno yeah that's a great idea, I know how to do it, but I don't know how to find the ratio to convert cm/px? thank you so much

ping @deltakosh

We may be able to provide helpers methods like CmToPixel and InchToPixel (and vice versa). @nmetulev What is your opinion?

That would be an interesting helper, should be straightforward to add. @Odonno, want to add it?

Was this page helpful?
0 / 5 - 0 ratings