syncfusion datagrid using material ui-revised
syncfusion datagrid using material ui-revised
DataGrid;
using Microsoft.Maui.Controls;
using System.Collections.ObjectModel;
namespace YourNamespace
{
public class YourPage : ContentPage
{
public YourPage()
{
try
{
// Sample data
var data = new ObservableCollection<YourDataModel>
{
new YourDataModel { Column1 = "Value1", Column2 = "Value2" },
new YourDataModel { Column1 = "Value3", Column2 = "Value4" }
};
// Create DataGrid
var dataGrid = new SfDataGrid
{
AutoGenerateColumns = false,
ItemsSource = data,
BackgroundColor = Color.White,
GridStyle = new MaterialGridStyle()
};
// Define columns
dataGrid.Columns.Add(new GridTextColumn
{
MappingName = "Column1",
HeaderText = "Header1",
CellStyle = new DataGridCellStyle { BackgroundColor =
Color.LightGray }
});
dataGrid.Columns.Add(new GridTextColumn
{
MappingName = "Column2",
HeaderText = "Header2",
CellStyle = new DataGridCellStyle { BackgroundColor =
Color.LightGray }
});