开发者

WPF: xceed datagrid, how to adjust column width at runtime?

开发者 https://www.devze.com 2023-03-05 16:28 出处:网络
I\'m trying to adjust the xceed datagrid at runtime and cannot find a s开发者_C百科etting for this, anyone have any experience with it?I am using Xceed\'s DataGridControl and its exactly as Matt sketc

I'm trying to adjust the xceed datagrid at runtime and cannot find a s开发者_C百科etting for this, anyone have any experience with it?


I am using Xceed's DataGridControl and its exactly as Matt sketched it. If your control is named dgCtrl, the code behind would look like this:

dgCtrl.Columns[0].Width = 100; // Sets the column's width to 100px.

You can also use the column names (FieldName property) to access the Columns:

dgCtrl.Columns["Address"].Width = 100;

Xceed's grid offers various options to adjust the width of the columns automatically at run-time. Refer to their online documentation for more info.


I haven't used the xceed datagrid, but does it not have a columns property like the normal one?

dataGrid.Columns[2]...


 foreach (Xceed.Grid.Column column in grdInterstitialView.Columns)
 {
      column.Width = (int)(column.GetFittedWidth() * 1.1M);
 }
0

精彩评论

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