Hello,
Welcome to our Microsoft Q&A platform!
There is a way to solve the problem of the height refresh of the Grid in the ScrollViewer
.
Listen to the SizeChanged
event of the ScrollViewer
and assign the height to the Grid:
xaml
xaml.cs
private void mainScrollViewer_SizeChanged(object sender, SizeChangedEventArgs e)
{
mainGrid.Height = e.NewSize.Height;
}
From your description, you seem to want to put the content on the last row, but this is contradictory to ScrollViewer itself.
That is, the total height of the current Grid will never be higher than the ScrollViewer, so the ScrollViewer will never scroll.
Even if the content of the Grid exceeds the height of the Grid itself, due to the characteristics of the Grid control (full of containers, but not exceeding, unless the Height property is explicitly declared), the content will be truncated.
So I suggest that you do not use adaptive design in the ScrollViewer, but use StackPanel as a container for internal elements.
The height of the StackPanel is determined by the content. Once the content is too high, the ScrollViewer will turn on scrolling, allowing users to scroll to view the content.
Regarding the inability to insert XML Code, check out this linked solution
Thanks