Created
June 23, 2012 13:39
-
-
Save rockhymas/2978331 to your computer and use it in GitHub Desktop.
ResizeGridColumns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private const int LAST_COL_MARGIN = 12; | |
private void ResizeGridColumns() | |
{ | |
var verticalScrollBar = dataGrid.GetDataGridVerticalScrollBar(); | |
var verticalScrollBarWidth = verticalScrollBar != null ? verticalScrollBar.Width : 0; | |
var horizontalScrollbar = dataGrid.GetDataGridHorizontalScrollBar(); | |
if (horizontalScrollbar != null) | |
horizontalScrollbar.Visible = false; | |
if (dataGrid.TableStyles.Count > 0) | |
{ | |
var tableStyle = dataGrid.TableStyles[0]; | |
tableStyle.GridColumnStyles[0].Width = dataGrid.ClientSize.Width - verticalScrollBarWidth - LAST_COL_MARGIN; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment