I want to make my UI more responsable and right now I have this problem:
<ScrollViewer VerticalScrollBarVisibility="Auto">
<DockPanel LastChildFill="True">
<StatusBar HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Stretch" DockPanel.Dock="Bottom">
<StatusBarItem>
<Ellipse Width="15" Height="15" Fill="{Binding StatusColor}"></Ellipse>
</StatusBarItem>
<StatusBarItem>
<TextBlock Text="{Binding StatusText}" ToolTip="{Binding StatusToolTip}"></TextBlock>
</StatusBarItem>
<StatusBarItem HorizontalAlignment="Right">
<TextBlock Text="{Binding StatusLastAction}"></TextBlock>
</StatusBarItem>
</StatusBar>
<Grid DockPanel.Dock="Bottom" Margin="0,0,0,10">
//
// Fields to edid data from MySelectedItem
//
</Grid>
<Grid DockPanel.Dock="Top">
<DataGrid MinHeight="150" AutoGenerateColumns="True" SelectedItem="{Binding MySelectedItem}" HorizontalAlignment="Stretch" Margin="10,10,10,0" VerticalAlignment="Stretch" ItemsSource="{Binding MyItems}" IsReadOnly="True"/>
</Grid>
</DockPanel>
</ScrollViewer>
This works like a charm until the point when the DataGrid gets to many items. The grid doesn't create a own scrollviewer it just uses the full height from the "Main"-ScrollViewer. (see image below - bottom-right)
Look here for wanted UI design (imgur)
black > Window
green > Scrollviewer
red > DataGrid
orange > fields to edit data
top left image (good):
- there is enough space in the window to show everything
- the
DataGrid(red) fills the available space and has a own scoll viewer if there are to many items to show
top right image (good):
- there isn't enough space to show all
- the 'DataGrid' uses the min-height and the
ScrollViewer(green) gets visible to show the rest (orange)
bottom left image (bad):
- there is not enough space to show all
- the
DataGriddoen't use the min-height
bottom right image (bad):
- there is enough space to show everything
- the
DataGriduses all needed space to show allItem
Is there a way to design the UI as shown in the top images?

MaxHeightset on DataGrid should help - AShMaxHeightit won't be responsive at some point. So this isn't a real opportunity.. but thanks for the idea! - bene_rawrMaxHeight<DataGrid ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.CanContentScroll="True" >- Celso LíveroMaxHeightof the DataGrid` to be, for example, 90% of your visible area of the screen, see, just, let's MaxHeight, that is, it may still be smaller, but not larger,MaxHeight = {Binding MaxHeightProperty}, and in your ViewModel you can calculate the MaxHeight - Celso Lívero