Hi guys,
I have an issue that I don't know how to resolve.
I am building a WPF C# application using a MVVM approach (well trying).
I have a container window that has a menu on the left hand side, on the right different views are loaded depending on which menu option is selected.
However, when I load a view that has a list box in it and the code behind starts adding items to the listbox's data source the listbox grows beyond the visible window. As a result it does not enable the scroll bar and the bottom entries cannot be seen.
My question is how can I ensure that my usercontrol, and in turn it's list box does not grow beyond the visible window of its container.
I tried putting the following in the user control Xaml but it has had no effect:
MaxHeight="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=ContentControl, AncestorLevel=1}, Path=Height}"
Any ideas what I could try because I would have thought this would bind the user controls MaxHeight to the size of the containing control (i.e. the cell in a grid where it is located)?