Is this a bug in TextBlock?


i trying scrollbar work text blocks.  not find option turn on or off scrollbars on textblock control embedded textblock in scrollviewer control, not work.  know how this?  text stops when run out of room instead of growing vertically fit contents.

   <scrollviewer horizontalalignment="stretch" margin="125,48,16,72" verticalalignment="stretch">
      <textblock text="simon: hello!" textwrapping="wrap" fontsize="12" x:name="textblockchat" height="104" width="232"/>
   </scrollviewer>

when add text my textblock can in c# add event add arbitrary height using textblock.height += 50; gets out of sync actual text size since there no way know height should or how need add.  textblock should grow hight of text in it, doesn't.  know how overcome this?

all need place textblock (withtextwrapping="wrap") in grid. make sure not set explicit height textblock. textblock grow in size till fills grid (within constraints of margins set on top , bottom). example, textblock below in grow in size big sl page itself.

<usercontrol width="400" height="auto">
    <grid x:name="layoutroot" background="white" height="auto" >
     <textblock textwrapping="wrap" width="150" height="auto" text="very long text"/>
    </grid>
</usercontrol>

jim (http://jimmangaly.blogspot.com/)

please mark replies answers if answered question



Silverlight  >  Programming Silverlight with .NET – General



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........