Adding An Item to WPF Datagrid (C#)
Hello!
VB.NET Version: Adding An Item to WPF Datagrid (VB.NET)
Here's the C# version of how to add an item manually to a WPF DataGrid.
Class property:
XAML code:
VB.NET Version: Adding An Item to WPF Datagrid (VB.NET)
Here's the C# version of how to add an item manually to a WPF DataGrid.
DataGridTextColumn c1 = new DataGridTextColumn(); c1.Header = "Test"; c1.Binding = new Binding("test"); c1.Width = 473; dataGrid.Columns.Add(c1); dataGrid.Items.Add(new Names() {test="just testing"});
public string test { get; set; }
<DataGrid AutoGenerateColumns="False" Height="289" HorizontalAlignment="Left" Margin="10,10,0,0" Name="dataGrid" VerticalAlignment="Top" Width="481" Grid.ColumnSpan="2" ItemsSource="{Binding }"> </DataGrid>
Comments
Post a Comment