Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > MarkupLabel Control
  New Posts New Posts RSS Feed - Stretch a TextBlock
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Stretch a TextBlock

 Post Reply Post Reply
Author
Message
Albert1 View Drop Down
Groupie
Groupie
Avatar

Joined: 01 February 2007
Location: Italy
Status: Offline
Points: 66
Post Options Post Options   Thanks (0) Thanks(0)   Quote Albert1 Quote  Post ReplyReply Direct Link To This Post Topic: Stretch a TextBlock
    Posted: 13 April 2015 at 6:45am
Any idea on how to render a TextBlock to fill available space.
 
Viewbox doesnt work:
 
  <Grid Width="400" Height="300">
    <Viewbox>
        <TextBlock TextWrapping="Wrap" Text="Some Text" />
    </Viewbox>
   </Grid>
 
neither ScaleTransform:
 
<TextBlock FontSize="20" Text="Some Text">
  <TextBlock.RenderTransform>
    <ScaleTransform ScaleX="2.5" ScaleY="1.0" />
  </TextBlock.RenderTransform>
</TextBlock>
 
Thank you
 
Product: Xtreme SuitePro (ActiveX) version 13.4.1 / 16.3.0

Platform: Windows Vista (32bit) - SP 2

Language: Visual Basic 6.0 (SP6)

Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 13 April 2015 at 11:17pm
Try HorizontalAlignment='Stretch' - it worked for me.
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
Albert1 View Drop Down
Groupie
Groupie
Avatar

Joined: 01 February 2007
Location: Italy
Status: Offline
Points: 66
Post Options Post Options   Thanks (0) Thanks(0)   Quote Albert1 Quote  Post ReplyReply Direct Link To This Post Posted: 14 April 2015 at 2:40am
I guess you mean to extend a Shape or a LayoutContainer. I need to auto size a TextBlock to fill the container.
 
Try to create a file .xaml with these lines:
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
 <Grid Width="400" Height="300" Background="#FFFFFF80">
  <Viewbox>
   <TextBlock Text="Some Text" />
  </Viewbox>
 </Grid>
</Page>
 
and execute with Internet Explorer. That's what I need.
 
 
Product: Xtreme SuitePro (ActiveX) version 13.4.1 / 16.3.0

Platform: Windows Vista (32bit) - SP 2

Language: Visual Basic 6.0 (SP6)

Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 14 April 2015 at 3:47pm
Not sure what you mean by execute with Internet Explorer - are you not using Codejock's MarkupLabel or other Codejock markup enabled control?

In Codejock's XAML implementation, if I drop the unsupported "ViewBox" tag, then the TextBlock fills the width and height of the Grid.


<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
 <Grid Width="400" Height="300" Background="#FFFFFF80">
   <TextBlock Background='Red' Text="Some Text" />
 </Grid>
</Page>

Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 16 April 2015 at 8:34pm
Any Luck?
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
Albert1 View Drop Down
Groupie
Groupie
Avatar

Joined: 01 February 2007
Location: Italy
Status: Offline
Points: 66
Post Options Post Options   Thanks (0) Thanks(0)   Quote Albert1 Quote  Post ReplyReply Direct Link To This Post Posted: 17 April 2015 at 2:45am
I'm giving up.
 
btw: I am using CJ MarkupControl. To write the XAML code, instead of use MarkupPad (no offence for CJ) I prefere to create a file .xaml, write the code with Notepad++ and render the .xaml code in Internet Explorer.
 
I dont want to stretch the container. I need to stretch the Fontsize to adapt to the container.
 
Without Viewbox:
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
 <Grid Width="200" Height="100" Background="#FFFFFF80">
  <TextBlock Background='Red' Text="Some Text" />
 </Grid>
</Page>
 
 
and what I need (using Viewbox or something else ...):
 
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
 <Grid Width="200" Height="100" Background="#FFFFFF80">
  <Viewbox>
   <TextBlock Background='Red' Text="Some Text" />
  </Viewbox>
 </Grid>
</Page>
 
 
The scope was to automatically resize the content. With MarkupLabel you can autoresize all objects excluding the text (or I am not able to so I asked here).
 
 
Product: Xtreme SuitePro (ActiveX) version 13.4.1 / 16.3.0

Platform: Windows Vista (32bit) - SP 2

Language: Visual Basic 6.0 (SP6)

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.