文本块文本未包装在wp7应用程序中

时间:2011-12-23 04:06:15

标签: windows-phone-7.1 windows-phone-7

wp7的新手,我不知道为什么文本块文本没有包装?

<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>

我绑定了元素的宽度,以便在设备重新定向宽度时相应地进行调整。这是错的吗?我该如何解决?感谢

2 个答案:

答案 0 :(得分:2)

你可以实际自定义你的消息框..像这样......

 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;
    }

和你的文字包装查询..我在我的app..i.e,Eula屏幕上有相同类型的设计来呈现许可协议..我们使用的是这样的......

<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>

使宽度自动,以便相应地调整两个方向..我希望它有助于你... Gud运气:))

答案 1 :(得分:0)

我很好奇您为什么不使用MessageBox来显示许可协议,而不是尝试将其重新创建为自定义控件?