2013-07-05 32 views
3

我正面臨下一個問題。它是微軟的錯誤嗎?ApplicationBar Windows Phone

我有列表框和應用程序欄。

肖像中的所有lok都很好,在景觀(-90)鰭,但在風景(+90)應用程序欄運行在列表框 - 如何解決它?

這是問題的一個圖片樣本:

景觀(-90)的所有工程確定:http://s13.postimg.org/4cvm07ck7/image.png 景觀(+90)醜:http://s13.postimg.org/rptnipsnr/Not_OK.png

我的下一個XAML代碼:

<phone:PhoneApplicationPage 
x:Class="RTUmobile.Home" 
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" 
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" 
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
mc:Ignorable="d" 
FontFamily="{StaticResource PhoneFontFamilyNormal}" 
FontSize="{StaticResource PhoneFontSizeNormal}" 
Foreground="{StaticResource PhoneForegroundBrush}" 
SupportedOrientations="PortraitOrLandscape" Orientation="Portrait" 
shell:SystemTray.IsVisible="True"> 

<!--LayoutRoot is the root grid where all page content is placed--> 
<Grid x:Name="LayoutRoot" Background="Transparent"> 
    <Grid.RowDefinitions> 
     <RowDefinition Height="Auto"/> 
     <RowDefinition Height="*"/> 
    </Grid.RowDefinitions> 
    <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28"> 
     <TextBlock Text="RTUmobile" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/> 
     <TextBlock Name="PageName" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/> 
    </StackPanel> 

    <!--ContentPanel - place additional content here--> 
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"/> 
    <ListBox Name="NewsListBox" Margin="10,1,12,0" Grid.Row="1" Height="auto" RenderTransformOrigin="0.5,0.5" SelectionChanged="NewsListBox_SelectionChanged"> 
     <ListBox.ItemContainerStyle> 
      <Style TargetType="ListBoxItem"> 
       <Setter Property="HorizontalContentAlignment" Value="Stretch" /> 
      </Style> 
     </ListBox.ItemContainerStyle> 
     <ListBox.RenderTransform> 
      <CompositeTransform Rotation="-0.02"/> 
     </ListBox.RenderTransform> 
    </ListBox> 
    <!--Uncomment to see an alignment grid to help ensure your controls are 
     aligned on common boundaries. The image has a top margin of -32px to 
     account for the System Tray. Set this to 0 (or remove the margin altogether) 
     if the System Tray is hidden. 

     Before shipping remove this XAML and the image itself.--> 
    <!--<Image Source="/Assets/AlignmentGrid.png" VerticalAlignment="Top" Height="800" Width="480" Margin="0,-32,0,0" Grid.Row="0" Grid.RowSpan="2" IsHitTestVisible="False" />--> 
</Grid> 
<phone:PhoneApplicationPage.ApplicationBar> 
    <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" Mode="Minimized"> 
     <shell:ApplicationBarIconButton IconUri="/Icons/home.png" IsEnabled="True" Text="1"/> 
     <shell:ApplicationBarIconButton IconUri="/Icons/about.png" IsEnabled="True" Text="2"/> 
     <shell:ApplicationBarIconButton IconUri="/Icons/contacts.png" IsEnabled="True" Text="3"/> 
     <shell:ApplicationBarIconButton IconUri="/Icons/settings.png" IsEnabled="True" Text="4"/> 
     <shell:ApplicationBar.MenuItems> 
      <shell:ApplicationBarMenuItem Text="MenuItem 1"/> 
      <shell:ApplicationBarMenuItem Text="MenuItem 2"/> 
      <shell:ApplicationBarMenuItem Text="MenuItem 2"/> 
      <shell:ApplicationBarMenuItem Text="MenuItem 2"/> 
      <shell:ApplicationBarMenuItem Text="MenuItem 2"/> 
      <shell:ApplicationBarMenuItem Text="MenuItem 2"/> 
      <shell:ApplicationBarMenuItem Text="MenuItem 2"/> 
     </shell:ApplicationBar.MenuItems> 
    </shell:ApplicationBar> 
</phone:PhoneApplicationPage.ApplicationBar> 

回答

1

我不知道reaso n,但是當您將ApplicationBarMode屬性設置爲Minimized時,會發生這種情況。

卸下該屬性或將其設置爲默認解決重疊問題:

<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" Mode="Default"> 
    ... 
</shell:ApplicationBar> 

然而,在肖像模式中的行爲不會是所希望的一個,因爲應用程序任務將不被最小化。

一個可能的解決方案是使用OrientationChanged活動頁面設置Mode屬性Minimized

private void OnOrientationChanged(object sender, OrientationChangedEventArgs e) 
    { 
     if (e.Orientation == PageOrientation.PortraitUp) 
      this.ApplicationBar.Mode = ApplicationBarMode.Minimized; 
     else 
      this.ApplicationBar.Mode = ApplicationBarMode.Default; 
    } 
2

保持的Horizo​​ntalAlignmentVerticalAlignment屬性列表框拉伸這將允許不會覆蓋。

編輯

  1. 保持應用程序欄的模式,以最小化,這將使其在總肖像模式和默認在橫向模式下最小化。此行爲無法更改。

  2. 爲了讓兩個方向改變supportedOrientation到LandscapePortrait

  3. 保持對齊伸展。