title: Column width of a DataGrid in a Windows Mobile Application
body: <p>I'm having problems trying to adjust the width of a column of a datagrid. I used the answer posted <a href="https://stackoverflow.com/questions/859464/what-is-the-datagrid-mappingname-for-a-non-datatable-datasource">here</a>, but I can't solve it.</p>
  
  <p>I'm using a List of objects as a datasource. In this simple example, I have just created a smart device application, and just added a datagrid. Then my code is this one:</p>
  
  <pre><code>    public Form1()
      {            
          InitializeComponent();
  
          List&lt;Prueba&gt; lista = new List&lt;Prueba&gt;();
          lista.Add(new Prueba("uno", "dos"));
          lista.Add(new Prueba("tres", "cuatro"));
  
          dataGrid1.DataSource = lista;
          DataGridTableStyle tableStyle = new DataGridTableStyle();
          tableStyle.MappingName = lista.GetType().ToString();
          DataGridTextBoxColumn tbcName = new DataGridTextBoxColumn();
          tbcName.Width = 4000;
          tbcName.MappingName = "UNO";
          tbcName.HeaderText = "UNO";
          tableStyle.GridColumnStyles.Add(tbcName);
          dataGrid1.TableStyles.Clear();
          dataGrid1.TableStyles.Add(tableStyle);
      }
  }
  
  public class Prueba
  {
      public string UNO { get; set; }
      public string DOS { get; set; }
  
      public Prueba(string uno, string dos)
      {
          this.UNO = uno;
          this.DOS = dos;
      }
  }
  </code></pre>
  
  <p>The width remains the same. Do you have a clue? Thank you!</p>