Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Why Markup Static doesn't word wrap?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Why Markup Static doesn't word wrap?

 Post Reply Post Reply
Author
Message
JohnLutz View Drop Down
Newbie
Newbie


Joined: 20 May 2008
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote JohnLutz Quote  Post ReplyReply Direct Link To This Post Topic: Why Markup Static doesn't word wrap?
    Posted: 22 May 2008 at 6:16pm
Why doesn't the text wrap in my static Markup?  Here's the XAML...
 

CString stackPanel = _T("<StackPanel Orientation='Horizontal'>");

CString image = _T("<Image Source='res://info.bmp' VerticalAlignment='Center'/>");

CString margin = _T("<StackPanel Margin='5, 0, 0, 0'>");

CString caption;

caption.Format(_T("<TextBlock TextAlignment='Left' FontWeight='Bold' TextWrapping='Wrap'>%s</TextBlock>"), captionStr);

CString note;

note.Format(_T("<TextBlock TextAlignment='Left' TextWrapping='Wrap'>%s</TextBlock>"), noteStr);

CString ending = _T("</StackPanel></StackPanel>");

CString text = stackPanel;

text += image;

text += margin;

text += caption;

text += note;

text += ending;

SetMarkupText(text);

Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 23 May 2008 at 1:28am
HI,
 
because this text located in Horizontal StackPanel. Horizontal StackPanel have INT_MAX width.
you have to replace it to Grid.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
JohnLutz View Drop Down
Newbie
Newbie


Joined: 20 May 2008
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote JohnLutz Quote  Post ReplyReply Direct Link To This Post Posted: 23 May 2008 at 10:27am
I tried a grid and it still doesn't wrap...
 

_T("<Border BorderThickness='1' BorderBrush='#808080'>")

_T("<Grid>")

_T("<Grid.ColumnDefinitions><ColumnDefinition Width='Auto'/><ColumnDefinition Width='Auto'/></Grid.ColumnDefinitions>")

_T("<Grid.RowDefinitions><RowDefinition/><RowDefinition/></Grid.RowDefinitions>")

_T("<Border Padding='3' Grid.Column='0' Grid.Row='0' BorderThickness='1' Background='#e0e0e0' BorderBrush='#808080'><TextBlock Text='caption:'/></Border>")

_T("<Border Padding='3' Grid.Column='0' Grid.Row='1' BorderThickness='1' Background='#e0e0e0' BorderBrush='#808080'><TextBlock Text='note:'/></Border>")

_T("<Border Padding='3' Grid.Column='1' Grid.Row='0' BorderThickness='1' Background='White' BorderBrush='#808080'><TextBlock Text='%s' FontWeight='Bold' TextWrapping='wrap'/></Border>")

_T("<Border Padding='3' Grid.Column='1' Grid.Row='1' BorderThickness='1' Background='White' BorderBrush='#808080'><TextBlock Text='%s' TextWrapping='wrap'/></Border>")

_T("</Grid>")

_T("</Border>"),

Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 23 May 2008 at 3:42pm

Hi,

try
_T("<Grid.ColumnDefinitions><ColumnDefinition Width='Auto'/><ColumnDefinition Width='*'/></Grid.ColumnDefinitions>")
 
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
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.062 seconds.