Resize column in wpf datagrid

I am currently developing WPF software. I am using WPF and trying to allow authors to size columns using datagrid.

I used columnwidth = "*", which works fine until the window is enclosed in scrollview. If it is in the scroll view, then the dimensions of the columns are really large, which leads to the fact that the datagrid will change more widely from the edge of the screen, causing a large amount of scrolling.

Thanks for any help you can provide.

+3
source share
1 answer

You can try to bind your scrollviewer Widthto ActualWidth DataGrid. So, ScrollViewerput this on (if your grid is called MyMainGrid):

Width="{Binding ElementName=MyMainGrid, Path=ActualWidth}"
+2

All Articles