c# - Winforms hosting WPF control and native wpf window look different -


when display wpf gui in native wpf window looks this

enter image description here

but when host in winfowms, looks this

winfowms host

wpf view code

        <stackpanel>            <stackpanel orientation="horizontal" >                <textblock x:name="tb1">histogram intervals:</textblock>                <textbox width="100"></textbox>            </stackpanel>            <stackpanel  orientation="horizontal">               <textblock x:name="tb2" width="105">mistie threshold, m:</textblock>               <textbox width="100" ></textbox>         </stackpanel>     </stackpanel> 

also, can see, there font render difference. how can solve these problems? updated: problem wpf native , wpf hosted inside winforms has different font. tb1 width changes in winforms, because not hard coded tb2, , depends on text render size.

bug happens because winforms set other font text in wpf control solved this, adding

 fontfamily="segoe ui" fontsize="12" 

to usercontrol, hosted winforms.

these attributes force winform use fonts.


Comments

Popular posts from this blog

sql - can we replace full join with union of left and right join? why not? -

javascript - Parallax scrolling and fixed footer code causing width issues -

iOS: Performance of reloading UIImage(name:...) -