I would approach this by binding the Visibility property of your controls to the width (or height, depending on your layout) of the window, through the converter. Consider something like this:
public class HideIfSmallConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { var c = value as IComparable; if (c == null) return Visibilty.Visible; return c.CompareTo(parameter) < 0 ? Visibility.Collapsed : Visibility.Visible; } }
Now we have a comparison that will allow us to collapse the element if the value is less than the given parameter. We can use it as follows:
<ListBox Visibility="{Binding ActualWidth,RelativeSource={RelativeSource FindAncestor,AncestorType=Window},Converter={StaticResource hideIfSmall},ConverterParameter=400}" />
So the idea is that the ListBox crashes if the window width drops below 400.
None of this has been tested, but hopefully this gives you some ideas.
source share