title: C# WPF Bindind DataGrid Columns Properties to list of classes
body: <p>can anyone help me with binding properties of datagridcolumn? I just don't understand how to do it.</p>
  <p>I have DataGrid with columns:
  xaml</p>
  <pre><code>&lt;DataGrid x:Name=&quot;DataGrid&quot; ItemsSource=&quot;{Binding Path=RPS, UpdateSourceTrigger=PropertyChanged}&quot; AutoGenerateColumns=&quot;False&quot;
                        IsReadOnly=&quot;True&quot; SelectedItem=&quot;{Binding SelectedItem}&quot;
                            material:DataGridAssist.CellPadding=&quot;0 5 3 5&quot;
                            material:DataGridAssist.ColumnHeaderPadding=&quot;4 2 2 2&quot;
                            Tag=&quot;{Binding DataContext, RelativeSource={RelativeSource AncestorType=UserControl}}&quot;&gt;
  
                          &lt;i:Interaction.Triggers&gt;
                              &lt;i:EventTrigger EventName=&quot;SelectionChanged&quot;&gt;
                                  &lt;i:InvokeCommandAction Command=&quot;{Binding SelectionChangedCommand}&quot; CommandParameter=&quot;{Binding ElementName=DataGrid, Path=SelectedItems}&quot;/&gt;
                              &lt;/i:EventTrigger&gt;
                          &lt;/i:Interaction.Triggers&gt;
                       
                          &lt;DataGrid.Columns&gt;
                              &lt;DataGridTextColumn Header=&quot;##&quot; Binding=&quot;{Binding TestNumber}&quot;&gt;&lt;/DataGridTextColumn&gt;
                              &lt;DataGridTemplateColumn Header=&quot;State&quot;&gt;
                                  &lt;DataGridTemplateColumn.CellTemplate&gt;
                                      &lt;DataTemplate&gt;
                                          &lt;Image Source=&quot;{Binding Icon}&quot; Width=&quot;15&quot; VerticalAlignment=&quot;Center&quot; ToolTip=&quot;{Binding Message}&quot; Height=&quot;15&quot;&gt;&lt;/Image&gt;
                                      &lt;/DataTemplate&gt;
                                  &lt;/DataGridTemplateColumn.CellTemplate&gt;
                              &lt;/DataGridTemplateColumn&gt;
                              
                             
                              &lt;DataGridTextColumn x:Name=&quot;ColSize&quot; Header=&quot;Size&quot; Binding=&quot;{Binding Size}&quot;&gt;&lt;/DataGridTextColumn&gt;
                              &lt;DataGridTextColumn x:Name=&quot;ColName&quot; Header=&quot;File Name&quot; Binding=&quot;{Binding Name}&quot;&gt;&lt;/DataGridTextColumn&gt;
                              &lt;DataGridTextColumn x:Name=&quot;ColVehicle&quot; Header=&quot;Vehicle&quot; Binding=&quot;{Binding Vehicle}&quot;&gt;&lt;/DataGridTextColumn&gt;
                              &lt;DataGridTextColumn x:Name=&quot;ColVersion&quot; Header=&quot;Version&quot; Binding=&quot;{Binding Version}&quot;&gt;&lt;/DataGridTextColumn&gt;
                              &lt;DataGridTextColumn x:Name=&quot;ColDateTime&quot; Header=&quot;DateTime&quot; Binding=&quot;{Binding DateTime, StringFormat=\{0:dd.MM.yy HH:mm:ss\}}&quot;&gt;&lt;/DataGridTextColumn&gt;
                              &lt;DataGridTextColumn x:Name=&quot;ColUnix&quot; Header=&quot;Unix&quot; Binding=&quot;{Binding ArenaCreationTime}&quot;&gt;&lt;/DataGridTextColumn&gt;
                             
                          &lt;/DataGrid.Columns&gt;
                          
                      &lt;/DataGrid&gt;
  </code></pre>
  <p>And List of columns params:</p>
  <pre><code>public List&lt;DataGridColumn&gt; Columns { get; set; }
  </code></pre>
  <p>class have variables:</p>
  <pre><code>public class DataGridColumn
  {
  public string Text { get; set; }
  public string SubText { get; set; }
  public bool IsVisible { get; set; }
  public int Width { get; set; }
  public int Position { get; set; }
  }
  </code></pre>
  <p>So, i don't know how bind columns with that list of classes. Help me pls.</p>