Hi, simple question, where is the API documentation? I am trying to find it for SFGrid for Maui.
I can find https://help.syncfusion.com/maui/datagrid/ but that does not give me the programming API info.
I am hoping to see all the c# class methods, etc that I can access.
For example, I would like to set cell contents programmatically, IE: mygrid[col,row] = "Data";
Hi Phunction,
You can explore the available API for the SfDataGrid control in our comprehensive documentation. Please refer to the following link for detailed documentation:
API Documentation: https://help.syncfusion.com/cr/maui/Syncfusion.Maui.DataGrid.html .
SfDataGrid is a data-bound control. You cannot set the value programmatically by passing the row and column index. Instead, you can update the value in the collection bound to it, and it will reflect the data in the view. We have provided a code snippet and sample for your reference.
Code snippet:
XAML
|
<StackLayout> <Button Clicked="Button_Clicked" Text="update [row 1,col 0] value"/> <sfDataGrid:SfDataGrid x:Name="dataGrid" ItemsSource="{Binding Employees}" SortingMode="Single"/> </StackLayout> |
C#
|
private void Button_Clicked(object sender, EventArgs e) { viewModel.Employees[0].EmployeeID = 100; } |
Regards,
Nirmalkumar
Is it possible to have more than one grid on a page, each with its own styling?
Hi Phunction,
Regarding your requirements, you have the option to define two default styles with distinct key values within the `ContentPage.Resources`. Subsequently, these defined styles can be set to the `SfDataGrid.DefaultStyle` property. Please refer to the code snippet provided below for further information on this approach.
|
<?xml version="1.0" encoding="utf-8"?> <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:MauiApp1" xmlns:dataGrid="clr-namespace:Syncfusion.Maui.DataGrid;assembly=Syncfusion.Maui.DataGrid" x:Class="MauiApp1.MainPage"> <ContentPage.BindingContext> <local:OrderInfoRepository/> </ContentPage.BindingContext> <ContentPage.Resources>
<dataGrid:DataGridStyle x:Key="customStyle" HeaderRowBackground="Violet" RowTextColor="DarkOrange" HeaderRowTextColor="Black"/> <dataGrid:DataGridStyle x:Key="customStyle1" HeaderRowBackground="Cyan" RowTextColor="Red" HeaderRowTextColor="Black"/> </ContentPage.Resources> <StackLayout> <dataGrid:SfDataGrid x:Name="dataGrid" HeightRequest="200" DefaultStyle="{StaticResource customStyle}" ItemsSource="{Binding OrderInfoCollection}" GridLinesVisibility="Both" HeaderGridLinesVisibility="Both"> </dataGrid:SfDataGrid> <dataGrid:SfDataGrid x:Name="dataGridTwo" HeightRequest="200" ItemsSource="{Binding OrderInfoCollection}" GridLinesVisibility="Both" DefaultStyle="{StaticResource customStyle1}" HeaderGridLinesVisibility="Both"> </dataGrid:SfDataGrid> </StackLayout> </ContentPage>
|
We hope this helps. In case we misunderstood your requirement, please provide more specific or clear use case details of your requirement. It will be helpful for us to check and provide an appropriate solution.
Regards,
Tamilarasan
No, that was perfect, thanks.