WPF SET WIDTH OF CONTROL BY BINDING IN CENTIMETER

Takeshi Okada

Total Post:89

Points:629
Posted by  Takeshi Okada
WPF 
WPF
 1335  View(s)
Ratings:
Rate this:

I want to set the width of my control by binding and in centimeters. (it's for the size of my printout so I find it easy to work with centimeters)

So I want to do something like this:

 <FlowDocument x:Name="flowdocument" PageWidth="{Binding Barcode.Width}" PageHeight="{Binding BarcodeSjabloon.Height}">

but I want to set it in centimeters like this:

 <FlowDocument x:Name="flowdocument" PageWidth="20cm" PageHeight="30cm">

Any idea how to achieve this?

  1. Pravesh Singh

    Post:412

    Points:2888
    Re: WPF set width of control by binding in centimeter

    Hi Takeshi,

    You can define a converter that understands your syntax and uses the current DPI setting to convert to an appropriate number of pixels.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!