How to bind a Listview MaxHeight to the current windows height?
data-binding, wpf
Solution
Another approach (without converter) would be to simply place it in a star-sized Grid. Certainly, this puts some restrictions on your layout. So, it depends on the other content whether this approach can be used or not.
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0.75*"/>
<RowDefinition Height="0.25*"/>
</Grid.RowDefinitions>
<ListView Grid.Row="0" VerticalAlignment="Top"/>
<!-- some other content -->
</Grid>
Since you wanted to specifiy the MaxHeight of the ListView, I have set the `VerticalAlignment` to `Top`, so that it does not use all the available space if it is not needed. Of course, you could also set this to `Bottom` or `Stretch`, depending on your requirements.
Problem
How to bind a Listview MaxHeight to the current windows height? I'd like to limit the height to let's say 3/4 of the windows height. How can I do that?