Cool Dude
Cool Dude

Reputation: 219

Textblock text not wrapping in wp7 app

new to wp7 and i have not the faintest idea why the textblock text is not wrapping?

<Popup x:Name="EulaPopUp" IsOpen="False">
            <Grid Background="White"  Width="{Binding ElementName=LayoutRoot, Path=Width}" Height="{Binding ElementName=LayoutRoot, Path=Height}">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="70"/>
                </Grid.RowDefinitions>
                <TextBlock Foreground="Black" Text="End User License Agreement" VerticalAlignment="Top" Grid.Row="0"/>
                <ScrollViewer HorizontalAlignment="Left" Name="scrollViewer1" Width="{Binding ElementName=ContentPanel, Path=Width}" VerticalAlignment="Top" Margin="0,30,0,0" Grid.Row="1">
                    <TextBlock Name="eulaTxt" Width="{Binding ElementName=ContentPanel, Path=Width}" Text="{Binding Path=AppResources.EULA, Source={StaticResource AppResources} }" HorizontalAlignment="Left" VerticalAlignment="Top" TextWrapping="Wrap" />
            </ScrollViewer>
            <Button Grid.Row="2" Content="I Agree" Background="Green" Height="70" HorizontalAlignment="Center" Margin="0" Name="EulaOK" VerticalAlignment="Bottom" Width="160" />
            </Grid>
        </Popup>

I'm binding the widths of the elements so that when the device reorients the widths adjust accordingly. Is this wrong? How can I fix it? Thanks

Upvotes: 1

Views: 1281

Answers (2)

Apoorva
Apoorva

Reputation: 1047

U can actually customize ur message box..something like this ...

 public static void customizedMessageBox(int messageboxtype, string title, string text, IEnumerable<string> buttons, int focusbutton, MessageBoxIcon icon, AsyncCallback callback, object state)
    {
        if (!Guide.IsVisible)
        {
            try
            {
                ProgressBarControl.dismissProgressBar();
                Guide.BeginShowMessageBox(" ", text, buttons, focusbutton, MessageBoxIcon.None, callback, state);
                messageboxType = messageboxtype;
            }
            catch (GuideAlreadyVisibleException ex)
            {
                Logger.log("MsgBox", "Exception : messageboxtype: " + messageboxtype
                    + "\n" + ex.Message + "\n" + ex.StackTrace);
            }
        }
        //return messageboxtype;
    }

and for ur text wrapping query.. I have the same type of design in my app..i.e, Eula screen to present the license agreement .. what we have used is something like this..

<Grid x:Name="EulaGrid" Grid.Row="1" Visibility="Collapsed">
        <ListBox x:Name="lbEula" Margin="18,100,19,135" ScrollViewer.VerticalScrollBarVisibility="Visible" Style="{StaticResource ListBoxStyle1}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="10"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <TextBlock Text="{Binding Text}"
                           TextWrapping="Wrap" 
                           IsHitTestVisible="False"
                           Width="Auto" FontFamily="Arial" FontSize="18" Foreground="Black" x:Name="eulaText" Grid.ColumnSpan="2" Grid.Column="2"/>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>

make the width Auto so that it will adjust accordingly for both orientations.. I hope it helps u.. Gud luck :)

Upvotes: 2

Claus J&#248;rgensen
Claus J&#248;rgensen

Reputation: 26345

I'm curious as to why you're not using a MessageBox to show the License Agreement in, rather than attempting to re-create it as a custom control?

Upvotes: 0

Related Questions