2011-12-23 58 views
1

新的wp7,我还没有最隐晦的想法,为什么文本块文本不包装?文本块文本不包裹在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> 

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

回答

0

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

+1

正确如果我错了,但MessageBox不是高度可定制的,我甚至不能在按钮上提供自定义标签,而且我也认为可以在消息框中显示的字符数量有限制? – 2011-12-23 06:50:35

+0

如果您的EULA扩展了此限制,则会出现其他更严重的问题。 (另外,没有向EULA提供“不同意”按钮,使其无效) – 2011-12-23 07:25:29

+0

老实说,它令人惊讶的wp7的一些限制,但考虑到它的微软毫不奇怪,我结束了与这家伙的可滚动文本块http:// blogs .msdn.com/b/priozersk/archive/2010/09/08/creation-scrollable-textblock-for-wp7.aspx和yeah同意按钮的逻辑也正在被解决。从应用程序的主要目标这么多不必要的干扰..叹息.. – 2011-12-23 07:29:59

2

U可以真正定制乌尔消息box..something这样的...

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

和UR文字环绕查询..我有相同类型的设计在我app..ie,尤拉屏幕呈现许可协议..我们采用的是这样的..

<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好运:)

+0

试过了(Guide.BeginShowMessageBox),它切断了超过256个字符的文本。 – 2011-12-23 07:58:15

+0

然后尝试第二个选项.. xaml部分..它会帮助..我们实际上使用包含文本块的列表框。 – Apoorva 2011-12-23 08:18:45