DataGrid控制列宽

 

最近帮朋友写个wince 的程序,要用到DataGrid。wince不能用 datagridview,用datagrid不习惯。数据字段比较长的时候,需要手动拉datagrid,比较麻烦。

网上找来资料,改了改:

Code

 

使用时候,报错 什么 索引column不能为负----莫名ing

研究下加入:

 

              // Create a table style that will hold the new column style
            // that we set and also tie it to our customer's table from our DB

      DataGridTableStyle tableStyle = new DataGridTableStyle();

 

            tableStyle.MappingName = "BOX";  

            // make the dataGrid use our new tablestyle and bind it to our table
            dataGrid1.TableStyles.Clear();
            dataGrid1.TableStyles.Add(tableStyle);

 

 

posted @ 2009-04-10 14:31  kaka骏  阅读(2521)  评论(5编辑  收藏  举报