0
votes

Is this possible to implement (Let's say, I have WPF Datagrid with 4 columns) :

  1. I want to set some minimum widths to columns (but only for auto resize)
  2. Once window, shrinks below some size (less than sum of minimum widths of all columns)
  3. But user shall be able to resize the column to zero size if desired.

Why I am looking for this is, if minimum width is set to zero, on resizing window, columns squeezes into each other and UI looks very bad. And horizontal scroll bar never appears.

In short, I am looking for best strategy to implement for minimum width and horizontal scroll bar for datagrid.

1

1 Answers

0
votes

Here is one example of how to implement responsive design in WPF and xaml in particular: A XAML implementation of CSS responsive design (WPF, WinRT, WP8) .

Another option will be to use DataTriggers with Converters to adapt layout changes depending on parent item ActualWidth:

<DataTrigger Value="True" Binding="{Binding ActualWidth, ElementName=[parentElement], Converter={StaticResource isSizeLessThan}, ConverterParameter=200}">
    <!-- Change layout -->
</DataTrigger>