Trigger the "OnCellSeperatorDoubleClick" in a WPF DataGridView?

I was just wondering if there was a way to trigger the same event that happens when you double click the line between two columns in a DGV. I would like 2 of my columns to, after setting the width of all of the columns, auto resize to the width of their text to take up the extra space.

Is that possible?


If you mean the WPF 'DataGrid', in .NET 4.0, from a quick look at PresentationFramework in ILSpy, it looks like all double clicking on the resize gripper does is sets the width of the column to DataGridLength.Auto.

So you could do something like the following to get the same result as double clicking:

someGrid.Columns[0].Width = DataGridLength.Auto;

If you want the column to fill available space (using the wpf star weighting) then you could use something like:

someGrid.Columns[0].Width = new DataGridLength(1, DataGridLengthUnitType.Star);

Need Your Help

Symfony 3.0 Openshift cannot find vendor/autoload.php

php openshift symfony

Hello I made a small gear to Openshift with php 5.4 and Postgresql and I try to make my first sympony app to work But somehow I get this weird logs:

How to load https:// websites on click of chrome extension

javascript java google-chrome google-chrome-extension

I have made a Chrome Extension for webpage translation but when I load a https:// based website and click on the chrome extension, it shows the shield icon and asks to click on to load unsafe scrip...