I have this screen, the user can change the Height, and based on that I want my ScrollViewer to show the scrollbar if needed but it turns to be always the same size.
Note that only the second line of the Parent Grid changes size (*) and based on that size I want my ScrollViewer size, and based on the content of the grid inside the ScrollViewer (that is added dynamically through code) the scrollBar should show.
<Grid Style="{StaticResource PopupBody}">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="*" />
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<!-- Header Panel -->
<StackPanel x:Name="PopupHeader"
Grid.Row="0">
<Label x:Name="PopupTitle"
Style="{StaticResource PopupTitle}"
Content="Column Updatable Detail"/>
</StackPanel>
<!-- Body Panel -->
<DockPanel x:Name="PopupBody"
Grid.Row="1"
Margin="10,10,10,0" Height="350" VerticalAlignment="Top">
<StackPanel DockPanel.Dock="Top" Margin="{StaticResource MarginSmallHorizontal}">
<Grid Margin="{StaticResource MarginSmallVertical}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50" />
<ColumnDefinition Width="250" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
(... Hidden to be more readable ... )
<ScrollViewer Grid.Row="1" Grid.ColumnSpan="3"
VerticalScrollBarVisibility="Auto"
CanContentScroll="True">
<Grid x:Name="gridData"
ShowGridLines="True"
Margin="0,0,0,0" >
</Grid>
</ScrollViewer>
</Grid>
</StackPanel>
</DockPanel>
<!-- Footer Panel -->
<Border Grid.Row="2"
Style="{StaticResource FooterBorder}">
<StackPanel x:Name="FooterPanel"
Style="{StaticResource FooterPanel}">
<Button x:Name="CancelButton"
Content="Close"
Style="{StaticResource FooterSecondaryButton}"
Click="OnCancelClicked"/>
</StackPanel>
</Border>
</Grid>
Can anybody help with this?
