Can't do scrolling inside scrollviewer

Refresh

March 2019

Views

594 time

1

When I added titlepanel I've lost ability to scroll. Please help me to recover it.

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

1 answers

2

Issue was in stackpanel.

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