1

当我添加标题面板时,我失去了滚动的能力。请帮我恢复它。

    <StackPanel>

            <Grid  HorizontalAlignment="Left">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <TextBlock .../>
            <TextBlock ... >
            </TextBlock>
        </Grid>
            <ScrollViewer  Grid.Row="1" x:Name="_ScrollViewer">
            <StackPanel  ScrollViewer.VerticalScrollBarVisibility="Disabled">
                <Grid ScrollViewer.VerticalScrollBarVisibility="Disabled"> 
                        <Grid.RowDefinitions>
                            <RowDefinition Height="auto" />
                            <RowDefinition Height="auto" />
                        </Grid.RowDefinitions>
                        <ListBox x:Name="listmy"
                                 Grid.Row="0" ScrollViewer.VerticalScrollBarVisibility="Disabled"
                                 >
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <local:TypeMessage Content="{Binding}">
                                        <local:TypeMessage.Me>
                                            <DataTemplate>
                                                ...
                                            </DataTemplate>
                                        </local:TypeMessage.Me>
                                        <local:TypeMessage.Other>
                                            <DataTemplate>
                                                ...
                                            </DataTemplate>
                                        </local:TypeMessage.Other>
                                    </local:TypeMessage>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                            <ListBox.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <VirtualizingStackPanel />
                                </ItemsPanelTemplate>
                            </ListBox.ItemsPanel>
                        </ListBox>
                        <Grid Grid.Row="3" ScrollViewer.VerticalScrollBarVisibility="Disabled">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="auto" />
                                <RowDefinition Height="auto" />
                            </Grid.RowDefinitions>
                            <tbox:WatermarkTextBox
                                                   ScrollViewer.VerticalScrollBarVisibility="Disabled"
                                                   />
                        </Grid>
                    </Grid>
                </StackPanel>
</ScrollViewer>
    </StackPanel>


</phone:PhoneApplicationPage>
4

1 回答 1

2

问题出在堆栈面板中。

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition />
    </Grid.RowDefinitions>
    <Grid Grid.Row="0" HorizontalAlignment="Left">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <TextBlock  />
        <TextBlock  >
            <TextBlock.Foreground>
                <SolidColorBrush Color="{StaticResource PhoneContrastBackgroundColor}"/>
            </TextBlock.Foreground>
        </TextBlock>
    </Grid>
    <ScrollViewer ScrollViewer.VerticalScrollBarVisibility="Visible"  Grid.Row="1" x:Name="_ScrollViewer">
            <Grid ScrollViewer.VerticalScrollBarVisibility="Disabled"> 
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto" />
                        <RowDefinition Height="auto" />
                    </Grid.RowDefinitions>
                <ListBox x:Name="listmy" ScrollViewer.VerticalScrollBarVisibility="Disabled"
                             Grid.Row="0">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <local:TypeMessage Content="{Binding}">
                                    <local:TypeMessage.Me>
                                     ...
                                    </local:TypeMessage.Me>
                                    <local:TypeMessage.Other>
                                    ...
                                    </local:TypeMessage.Other>
                                </local:TypeMessage>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                        <ListBox.ItemsPanel>
                            <ItemsPanelTemplate>
                                <VirtualizingStackPanel />
                            </ItemsPanelTemplate>
                        </ListBox.ItemsPanel>
                    </ListBox>
                <StackPanel Grid.Row="1" ScrollViewer.VerticalScrollBarVisibility="Disabled">
                    <tbox:WatermarkTextBox />
                </StackPanel>
            </Grid>

于 2012-08-05T09:22:21.063 回答