C# 列表框与问题重叠后的列表框

C# 列表框与问题重叠后的列表框,c#,xaml,windows-phone-7,listbox,C#,Xaml,Windows Phone 7,Listbox,我有一个列表框新闻和列表框评论,我试图显示: 列表框新闻 列表框注释 但是没有成功。 我有,这是xaml: <phone:PhoneApplicationPage xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:phone=

我有一个列表框新闻和列表框评论,我试图显示:

列表框新闻

列表框注释

但是没有成功。 我有,这是xaml:

<phone:PhoneApplicationPage
    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:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:delay="clr-namespace:Delay;assembly=PhonePerformance"
    xmlns:local="clr-namespace:iVk" 
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" 
    x:Class="iVk.newsDetail" 
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="True"
    >

  <!--LayoutRoot is the root grid where all page content is placed-->
  <Grid x:Name="LayoutRoot">
    <Grid Height="auto" Grid.Row="2" Grid.ColumnSpan="2" Margin="0,0,0,21" >
      <ListBox Style="{StaticResource ax3}" x:Name="detailnewslistBox">
        <ListBox.ItemTemplate>
          <DataTemplate>
            <local:FoodTemplateSelector Content="{Binding}">
              ...
            </local:FoodTemplateSelector>
          </DataTemplate>
        </ListBox.ItemTemplate>
        <ListBox.ItemsPanel>
          <ItemsPanelTemplate>
            <StackPanel/>
          </ItemsPanelTemplate>
        </ListBox.ItemsPanel>
      </ListBox>     
    </Grid>
    <Grid Height="auto" Margin="0,0,0,21" >
      <ListBox x:Name="comm_box" ItemsSource="{Binding}">
        <ListBox.ItemTemplate>
          <DataTemplate>
            <Grid Margin="{StaticResource PhoneTouchTargetOverhang}">
              <StackPanel VerticalAlignment="Top">
                <TextBlock Text="{Binding text}" Padding="11,0,0,0"/>
                <TextBlock x:Name="datetimetext" Text="{Binding date_time}"  Width="310">
                </TextBlock>
              </StackPanel>
            </Grid>
          </DataTemplate>
        </ListBox.ItemTemplate>
        <ListBox.ItemsPanel>
          <ItemsPanelTemplate>
            <StackPanel/>
          </ItemsPanelTemplate>
        </ListBox.ItemsPanel>
      </ListBox>
    </Grid>
  </Grid>
  
</phone:PhoneApplicationPage>

...

您需要在scrollViewer中包装两个列表框,并禁用列表框的滚动:

<ScrollViewer VerticalScrollBarVisibility="Enabled">
    <StackPanel>
        <ListBox ScrollViewer.VerticalScrollBarVisibility="Disabled" />
        <ListBox ScrollViewer.VerticalScrollBarVisibility="Disabled" />
    </StackPanel>
</ScrollViewer>