c# - Column width of a DataGrid in a Windows Mobile Application -


I have a problem adjusting the width of a column of the datagrid. I had posted the answer, but I solved it can not do.

I am using a list of objects as a data source in this simple example, I have just created a smart device application, and just added a datagrace. Then my code is:

  public form 1 () {InitializeComponent (); & Lt; Prueba & gt; Lista = new list & lt; Prueba & gt; (); Lista.Add (New Prueba ("uno", "Doctor")); Lista.Add (New Prueba ("Three", "Dog")); DataGrid1.DataSource = List; DataGridTableStyle Table Style = New DataGridTableTable (); Table style.mapnamename = list Gettype () ToString (); DataGridTextBoxColumn TBCName = New DataGridTextBoxColumn (); TBC name With = 4000; TbcName.MappingName = "UNO"; TbcName.HeaderText = "UNO"; TableStyle.GridColumnStyles.Add (tbcName); DataGrid1.TableStyles.Clear (); DataGrid1.TableStyles.Add (tableStyle); }} Public square Prueba {public string UNO {get; Set; } Public string dos {get; Set; } Public Prueba (string uno, string dos) {this.UNO = uno; this. Dos = dos; }}  

The width is the same. Do you have any clue? Thanks!

Change this line

  tableStyle.MappingName = lista .GetType () ToString () .;  

to

  tableStyle.MappingName = lista.GetType (). Name;  

Oh, and 4000 is a bit big for mobile, but I think it's a typo.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -