开发者

static DataGrid column width in C# in visual studio 2010

I tried doing

for (int x = 0; x < gridQuestion.Columns.Count; x++)
{
    gridQuestion.Columns[x].ItemStyle.Width = 50;
}

but 开发者_StackOverflow社区the columns still go across the page (not wrapping).

It should wrap if I get it right yes?


Try the Wrap property of the ItemStyle (though it should be true by default):

for (int x = 0; x < gridQuestion.Columns.Count; x++)
{
    gridQuestion.Columns[x].HeaderStyle.Width = 50;
    gridQuestion.Columns[x].ItemStyle.Width = 50;
    gridQuestion.Columns[x].ItemStyle.Wrap = true;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜