The issue: Cannot get the Vertical Scroll bar for the DataGrid to appear unless I set a static height on the grid. I know similar questions have been asked before, however unlike other questions my example is a lot more simple with no Grid Columns. The DataGrid is simply inside a StackPanel inside the control. That's it, and no combination of Auto, "*", etc works except setting a static Height.
Is this simply a lacking feature in WPF framework that it a Observable Collection on the ViewModel bound to a grid, will not notify the View when items are added to the VM Collection? Do I have to code a custom property and bind the DataGrid Height to that?
Here is my XMAL:
<Window x:Class="Monster.Configure"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewModels="clr-namespace:Monster.ViewModels"
xmlns:local="clr-namespace:Monster"
mc:Ignorable="d"
Title="Configure" Width="1200">
<Window.DataContext>
<viewModels:ViewModelMain/>
</Window.DataContext>
<Window.Resources>
<BooleanToVisibilityConverter x:Key="b2v" />
</Window.Resources>
<Grid>
<StackPanel Margin="5">
<Button Name="button_Refresh" Content="Save / Refresh" HorizontalAlignment="Left" Margin="5" Width="100"
Click="button_Refresh_Click"></Button>
<StackPanel Orientation="Horizontal">
<!--Buttons and other junk here-->
</StackPanel>
<Label></Label>
<DataGrid Name="dataGrid_PendingCreation" CanUserAddRows="True" CanUserDeleteRows="True" AutoGenerateColumns="False"
ItemsSource="{Binding URLsForGrid}"
Loaded="dataGrid_PendingCreation_Loaded"
CellEditEnding="dataGrid_PendingCreation_CellEditEnding"
ScrollViewer.CanContentScroll="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollBarVisibility ="Auto"
Width="Auto" Height="Auto">
<DataGrid.Columns>
<!--Columns and junk here-->
</DataGrid.Columns>
</DataGrid>
</StackPanel>
</Grid>
</Window>
As you can see, the user is allowed to add new rows. When doing so, a Vertical Scroll Bar never shows up unless a Static Height is set in the DataGrid.