|
public class MainActivity : Activity
{
private SfDataGrid dataGrid;
private TextView orderIDTextView;
private TextView customerIDTextView;
private TextView shipCountryTextView;
private TextView customerTextView;
private TextView shipCityTextView;
protected override void OnCreate(Bundle bundle)
{
dataGrid = new SfDataGrid(this);
orderIDTextView = new TextView(this);
customerIDTextView = new TextView(this);
shipCountryTextView = new TextView(this);
customerTextView = new TextView(this);
shipCityTextView = new TextView(this);
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
OrderInfoRepository viewModel = new OrderInfoRepository();
dataGrid.ItemsSource = viewModel.OrderInfoCollection;
dataGrid.AutoGenerateColumns = false;
dataGrid.ColumnSizer = ColumnSizer.Star;
orderIDTextView.Text = "Order ID";
orderIDTextView.Gravity = Android.Views.GravityFlags.Center;
orderIDTextView.SetBackgroundColor(Color.SandyBrown);
orderIDTextView.SetTextColor(Color.Black);
…
GridTextColumn OrderIDColumn = new GridTextColumn();
OrderIDColumn.MappingName = "OrderID";
OrderIDColumn.HeaderTemplate =orderIDTextView;
OrderIDColumn.LoadUIView = true;
…
dataGrid.Columns.Add(CustomerIDColumn);
dataGrid.Columns.Add(OrderIDColumn);
dataGrid.Columns.Add(ShipCountryColumn);
dataGrid.Columns.Add(CustomerColumn);
dataGrid.Columns.Add(ShipCityColumn);
LinearLayout linear = FindViewById<LinearLayout>(Resource.Id.linear);
linear.AddView(dataGrid);
}
}
|