W poniższej wersji XAML do WPF ScrollViewer nie działa (wyświetla pasek przewijania, ale nie można przewijać, a zawartość wychodzi z okna na dół).Jak można uzyskać ScrollViewer do pracy wewnątrz StackPanel?
Mogę zmienić zewnętrzny StackPanel na Grid, który zadziała.
Jednak w mojej aplikacji, z której odtworzono poniższy kod, potrzebuję zewnętrznego zewnętrznego StackPanel. Co muszę zrobić do StackPanel, aby ScrollViewer pokazywał użyteczny pasek przewijania? np. VerticalAlignment = "Stretch" Wysokość = "Auto" nie działają.
<StackPanel>
<ScrollViewer>
<StackPanel>
<TextBlock Text="This is a test"/>
<TextBlock Text="This is a test"/>
<TextBlock Text="This is a test"/>
<TextBlock Text="This is a test"/>
<TextBlock Text="This is a test"/>
<TextBlock Text="This is a test"/>
<TextBlock Text="This is a test"/>
<TextBlock Text="This is a test"/>
<TextBlock Text="This is a test"/>
<TextBlock Text="This is a test"/>
<TextBlock Text="This is a test"/>
<TextBlock Text="This is a test"/>
<TextBlock Text="This is a test"/>
<TextBlock Text="This is a test"/>
<TextBlock Text="This is a test"/>
<TextBlock Text="This is a test"/>
<TextBlock Text="This is a test"/>
<TextBlock Text="This is a test"/>
<TextBlock Text="This is a test"/>
<TextBlock Text="This is a test"/>
<TextBlock Text="This is a test"/>
<TextBlock Text="This is a test"/>
<TextBlock Text="This is a test"/>
<TextBlock Text="This is a test"/>
<TextBlock Text="This is a test"/>
<TextBlock Text="This is a test"/>
<TextBlock Text="This is a test"/>
</StackPanel>
</ScrollViewer>
</StackPanel>
chciał stos rzeczy i stosując siatkę trzeba ręcznie zarządzać wszystkie wiersze i kolumny, ale DockPanel działa ładnie więc będę przełączyć się, że dzięki. –
Zgadzam się z Edwardem. Z mojego doświadczenia wynika, owijając moje DataGrids w DockPanel, a następnie ustawiając DockPanel.Dock = "Top" dla każdego DataGrid działało świetnie. – CINCHAPPS
Którą alternatywną kontrolę należy stosować w UWP? Nie ma DockPanel. Dziękuję Ci. –