© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4mo ago•
2 replies
Martin

ScrollViewer in Avalonia DockPanel not scrolling to show all content when dynamically adding items.

Setup:
- Using Avalonia 11.2.2 with MVVM pattern
- Dialog with fixed height (700px) containing a DockPanel
- DockPanel structure:
- Header docked to Top (contains title + buttons)
- ScrollViewer fills remaining space (LastChildFill="True")
- ScrollViewer contains a StackPanel with form fields and an ItemsControl for dynamic items


<Border Height="700">
    <DockPanel Background="#1E1E1E" LastChildFill="True">
      <Border DockPanel.Dock="Top"><!-- Header --></Border>

      <ScrollViewer Padding="20" VerticalScrollBarVisibility="Auto">
        <StackPanel Spacing="15">
          <!-- Static form fields (TextBoxes, ComboBoxes) -->
          <!-- ItemsControl with dynamically bound collection -->
        </StackPanel>
      </ScrollViewer>
    </DockPanel>
</Border>
<Border Height="700">
    <DockPanel Background="#1E1E1E" LastChildFill="True">
      <Border DockPanel.Dock="Top"><!-- Header --></Border>

      <ScrollViewer Padding="20" VerticalScrollBarVisibility="Auto">
        <StackPanel Spacing="15">
          <!-- Static form fields (TextBoxes, ComboBoxes) -->
          <!-- ItemsControl with dynamically bound collection -->
        </StackPanel>
      </ScrollViewer>
    </DockPanel>
</Border>


When adding multiple items to the ItemsControl, the ScrollViewer doesn't scroll far enough to show the last items. Content appears cut off around 500px total height, even though the dialog is 700px tall and
there's more content below.

How do I ensure the ScrollViewer in a DockPanel properly scrolls through ALL content when items are dynamically added to an ItemsControl within a StackPanel?

Picture (Function 2 is missing):
image.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ Issues with dynamically adding an icon from Avalonia.Icons.Material to an Avalonia ToggleButton
C#CC# / help
14mo ago
How To Set Vertical Snap Points on Avalonia ScrollViewer
C#CC# / help
2y ago
❔ Centering in dockpanel
C#CC# / help
4y ago
❔ Avalonia nested ItemsRepeater datatemplates
C#CC# / help
3y ago