wpf - how to make texts in two Viewboxes the same size? -



wpf - how to make texts in two Viewboxes the same size? -

in wpf, using viewbox create text automatically resize. problem texts end different fonts because shorter text show bigger.

<grid> <!--grid definitions--> <textblock text="short text" grid.row="1" grid.column="0" x:name="tb2" fontsize="{binding elementname=tb3, path=fontsize}"/> <--here <viewbox grid.column="0" grid.row="2"> <textblock text="looooong text" x:name="tb3" style="{staticresource txtnormal}"/> </viewbox> </grid>

in line marked "here", tried bind font size of 1 textblcok another, doesn't work. i've tried using stretchdirection="downonly"; while create them same size, much smaller. saw this post , tried set viewbox outside of grid, messes column width ratio defined in columndefinition.

so how create texts in different viewboxes same size? thanks!

put other textblock (short text) in viewbox also, , bind viewbox maxheight actualheight of other viewbox (long text).

<viewbox maxheight="{binding elementname=vb, path=actualheight}"> <textblock text="short text" grid.row="0" grid.column="0" x:name="tb2" /> </viewbox> <viewbox name="vb" grid.column="0" grid.row="1"> <textblock text="looooooooooong text" x:name="tb3"/> </viewbox>

wpf

Comments

Popular posts from this blog

java Multi query from Mysql using netbeans -

c# - DotNetZip fails with "stream does not support seek operations" -

c++ - StartServiceCtrlDispatcher don't can access 1063 error -