BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
Hi
sfdatagrid Rows collection doesn't exist.
The following code give me the number of rows. Is it the best practice to get the number of rows ?
public partial class OrderInfoRepositoryView : ContentPage
{
public OrderInfoRepositoryView()
{
InitializeComponent();
//BindingContext = vm.OrderInfoCollection;
SfDataGrid dataGrid = new();
OrderInfoRepositoryViewModel viewModel = new();
dataGrid.ItemsSource = viewModel.OrderInfoCollection;
}
private void GetNumberofRows_Clicked(object sender, EventArgs e)
{
var nbOfRows = viewModel.OrderInfoCollection.Count;
DisplayAlert("Number of Rows", $"the number of rows is {nbOfRows}.", "ok");
}
}
Hi,
You can use the Count property of the underlying collection, viewModel.OrderInfoCollection, to determine the number of items in the collection. However, this count will not update when you apply filters to the DataGrid. If you want to include the filtered rows in your count, we recommend using the View.Records property of the DataGrid. Here is an example of how to use it:
private void GetNumberofRows_Clicked(object sender, EventArgs e) { var nbOfRows = dataGrid.View.Records.Count; DisplayAlert("Number of Rows", $"the number of rows is {nbOfRows}.", "ok"); } |
Please let us know if we misunderstood your query.
Regards,
Nirmalkumar
Thank for the reply. It does clarify my needs.
We are glad that your requirement has been met on your side. Please let us know if you need further assistance. As always, we are happy to help you out.