locked
How to Contain Textblock Contents in my Grid Column? RRS feed

  • Question

  • Hi All,

    I'm developing my first SL4 business application and have a layout issue.  My goal is a 3-column layout in the main viewspace of the page.  To accomplish this, I used a Grid control, set my columns and placed StackPanels in each column.  Within each StackPanel, I've placed TextBlocks with wordwrap = true.  When I run my app, the contents of the left column run into the middle column etc.  How can this be prevented?

    Thanks,

    Sid

    <Grid Margin="0,62,0,8">
                	<Grid.ColumnDefinitions>
                		<ColumnDefinition Width="Auto" MinWidth="116"/>
                		<ColumnDefinition Width="Auto" MinWidth="376"/>
                		<ColumnDefinition Width="Auto" MinWidth="148"/>
                	</Grid.ColumnDefinitions>
    				<StackPanel Grid.Column="0" HorizontalAlignment="Left">
    					<TextBlock FontFamily="Verdana" HorizontalAlignment="Left">
    						Current Statistics
    						<LineBreak></LineBreak>
    						Users Online:
    						<LineBreak></LineBreak>
    						Users:
    						<LineBreak></LineBreak>
    						Organizations:
    						<LineBreak></LineBreak>
    						Resources:
    						<LineBreak></LineBreak>
    					</TextBlock>
    				</StackPanel>
    				<StackPanel Grid.Column="1" HorizontalAlignment="Center">
    					
    					
    				</StackPanel>
    				<StackPanel Grid.Column="2" HorizontalAlignment="Right">
    					<TextBlock FontFamily="Verdana" FontWeight="Bold" HorizontalAlignment="Right">
    						Latest News:
    						
    					</TextBlock>
    					
    				</StackPanel>
                </Grid


     

    Friday, October 8, 2010 6:32 PM

Answers

  • I do not see in the xaml that the word wrap has been set.  You should set the textblocks width if you want the word wrap to work

    Friday, October 8, 2010 7:42 PM