2011-12-23 53 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