tags:

views:

187

answers:

0

I am using a DataGrid to display details of an item selected in a ListBox. The DataGrid has 3 columns set to Width="Auto".

As different items in the ListBox are selected, the width of the columns in the DataGrid increase as needed in order to display the text. What I want is that the column widths also decrease when the extra width is not needed.

An example. Column 1 normally contains a percent value. However, in some cases it contains a long error message which causes column 1 to widen and push columns 2 & 3 off the screen. When I switch to an item containing normal values, I want column 1 to regain its' normal width and for columns 2 & 3 to be visible again.

What can I do to force the column widths to take the minimum size?