Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
147370 | Sep 8,2019 04:24 AM UTC | Sep 9,2019 11:56 AM UTC | Xamarin.Forms | 1 |
![]() |
Tags: SfDataGrid |
public partial class MainPage : ContentPage
{
SfDataGrid dataGrid;
ViewModel viewModel;
public MainPage()
{
InitializeComponent();
dataGrid = new SfDataGrid();
viewModel = new ViewModel();
this.BindingContext = viewModel;
dataGrid.ColumnSizer = ColumnSizer.Star;
dataGrid.ItemsSource = viewModel.OrdersInfo;
dataGrid.ShowRowHeader = true;
dataGrid.AutoGeneratingColumn += DataGrid_AutoGeneratingColumn;
dataGrid.RowHeaderTemplate = new DataTemplate(() =>
{
var label = new Label();
label.SetBinding(Label.TextProperty, new Binding("Index", BindingMode.Default, null, null, null, null));
return label;
});
this.Content = dataGrid;
}
private void DataGrid_AutoGeneratingColumn(object sender, AutoGeneratingColumnEventArgs e)
{
if (e.Column.MappingName == "Index")
e.Cancel = true;
}
}
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.