I have a problem with the datagrid in the code below growing outside the parent window boundaries. Eventually, the vertical scroll bar appears but extends well below the parent window. I have searched and found that this is a common problem and has been for years? The only solution I've found is to try different parent types etc. This seems like a bug to me. Is MS no longer actively supporting WPF?
Thanks for your help
"
<window x:class="wpfPollingFileWatcher.MainWindow" xmlns:x="#unknown">
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:wpfPollingFileWatcher"
Title="MainWindow" Height="475" Width="675">
<window.datacontext>
<local:changeviewmodel xmlns:local="#unknown">
<grid>
<grid.rowdefinitions>
<rowdefinition height="0.5*">
<rowdefinition height="0.5*">
<grid grid.row="0">
<grid.rowdefinitions>
<rowdefinition height="Auto">
<rowdefinition height="Auto">
<stackpanel orientation="Horizontal" grid.row="0">
<Button Name="AddButton" Content="Add" Margin="5" Width="40" HorizontalAlignment="Left"/>
<Button Name="DelButton" Content="Del" Margin="5" Width="40" HorizontalAlignment="Left"/>
<scrollviewer verticalscrollbarvisibility="Auto" grid.row="1">
<datagrid name="WatchesDataGrid" height="Auto">
<grid grid.row="1">
<grid.rowdefinitions>
<rowdefinition height="Auto">
<rowdefinition height="Auto">
<Button Name="ClearButton" Content="Clear" Grid.Row="0" Width="40" Margin="5,5,0,5" HorizontalAlignment="Left" Command="{Binding AddChange}" Grid.ColumnSpan="2"/>
<datagrid name="ChangesDataGrid" grid.row="1" height="{Binding RelativeSource={RelativeSource AncestorType={x:Type Window}}, Path=ActualHeight}" itemssource="{Binding Changes}">
ScrollViewer.CanContentScroll="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility="Auto" Margin="0,0,0,8" HorizontalContentAlignment="Stretch" Grid.ColumnSpan="3"/>
"