font size - working with fontstretch in wpf -


i want learn how utilize fontstretch in wpf applications.

i've created simple usercontrol, border rounded corners has textblock. want stretch text of textblock fill border. want avoid use of viewbox control this.

this usercontrol xaml

 <usercontrol x:class="displayobject"              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"               xmlns:d="http://schemas.microsoft.com/expression/blend/2008"               mc:ignorable="d"               d:designheight="300" d:designwidth="400" background="transparent">     <usercontrol.resources>         <lineargradientbrush x:key="backgroundbrush" startpoint="0,0" endpoint="1,1">             <gradientstop color="antiquewhite" offset="0"/>             <gradientstop color="white" offset="0.45" />             <gradientstop color="silver" offset="1" />         </lineargradientbrush>     </usercontrol.resources>     <border x:name="layoutroot" cornerradius="12" background="{staticresource backgroundbrush}" borderbrush="black" borderthickness="2">         <textblock textalignment="center" text="{binding path=displaytext}"                     background="transparent" horizontalalignment="center" verticalalignment="center"                     textwrapping="wrap" fontsize="12" fontfamily="arial" fontstretch="ultraexpanded"/>     </border> </usercontrol> 

from gather reading online arial font opentype supports stretching. tried using horizontal/vertical alignment values of "stretch" did not help. not sure have done wrong figured on site may able explain why not stretching me, , how fix it.

thanks reading post.

the arial font not seem support fontstretch value of ultraexpanded. try value of ultracondensed instead see work:

<grid>     <grid.rowdefinitions>         <rowdefinition />         <rowdefinition />     </grid.rowdefinitions>     <textblock grid.row="0" text="{binding displaytext}" fontsize="30"          fontfamily="arial" horizontalalignment="center" verticalalignment="center" />     <textblock grid.row="1" text="{binding displaytext}" fontsize="30"          fontfamily="arial" horizontalalignment="center" verticalalignment="center"          fontstretch="ultracondensed" /> </grid> 

look @ why fontstretch not work in wpf? post find out alternative using little used property.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -