public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
datagrid = new NewGrid
{
ColumnSizer = GridLengthUnitType.Star,
AutoGenerateColumns = true,
NavigationMode = NavigationMode.Cell,
AllowEditing = true,
AutoGenerateRelations = false,
};
datagrid.SetBinding(SfDataGrid.ItemsSourceProperty, new Binding {Path = new PropertyPath("OrderInfoCollection")});
datagrid.Columns.Add(new GridTextColumn
{
MappingName = "OrderID",
HeaderText = "Order ID",
});
datagrid.Columns.Add(new GridTextColumn
{
MappingName = "CustomerID",
HeaderText = "Customer ID",
});
datagrid.Columns.Add(new GridTextColumn
{
MappingName = "CustomerName",
HeaderText = "Customer Name",
});
datagrid.Columns.Add(new GridTextColumn
{
MappingName = "Country",
HeaderText = "Country",
});
datagrid.Columns.Add(new GridTextColumn
{
MappingName = "ShipCity",
HeaderText = "Ship City",
});
grid.Children.Add(datagrid);
}
private SfDataGrid datagrid;
}