Textblock on my Silverlight StackPanel

Asked By 10 points N/A Posted on -
qa-featured

 

The text in the textblock on my Silverlight StackPanel that are horizontally oriented to do wrap even if it is set to wrap. How can I resolve the issue?

SHARE
Answered By 0 points N/A #91377

Textblock on my Silverlight StackPanel

qa-featured

That may be happening because the internal Stack Panel, and every other Stack Panel that is in use does not constraint its children to the "visible" space that is found in the Stack Panel. And for that reason, the scroll viewer  for the application feels like having unlimited space, and the text block too has an unlimited space. You will need to use the Grid itself to correct that and the following is the code that you will need for that:

<StackPanelName="panel">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <TextBlock Text="Text:"/>
        <ScrollViewerGrid.Column="1"
                                    BorderThickness="0"
                                    Height="33"
                                    VerticalScrollBarVisibility="Auto"
                                    HorizontalScrollBarVisibility="Disabled">
            <TextBlockTextWrapping="Wrap"
                                    Text="YourText"/>
        </ScrollViewer>
    </Grid>
</StackPanel>


-Experttechyv

 

Login/Register to Answer

Related Questions