CustomDataTable 1.0.0

dotnet add package CustomDataTable --version 1.0.0                
NuGet\Install-Package CustomDataTable -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CustomDataTable" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CustomDataTable --version 1.0.0                
#r "nuget: CustomDataTable, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install CustomDataTable as a Cake Addin
#addin nuget:?package=CustomDataTable&version=1.0.0

// Install CustomDataTable as a Cake Tool
#tool nuget:?package=CustomDataTable&version=1.0.0                

CustomDataTable

A DataTable with a DataRow that implements INotifyDataErrorInfo for async-validation.

Example

In your view-model (or code-behind):

//1. Property to bind your grid ItemsSource to
public CustomDataTable Data
{
  get
  {
     if (data == null)
     {
       data = GenerateData();
     }
     
     return data;
  }
}

// your Data (usually from a DB)
private CustomDataTable GenerateData()
{
  CustomDataTable dataTable = new(); 
  dataTable.AddColumn("Name", true); // readonly
  dataTable.AddColumn("StadiumCapacity", typeof(int));    
  dataTable.AddColumn("Established", typeof(DateTime));

  var row = dataTable.NewCustomRow();
  row.SetPropertyValue("Name", "Liverpool");
  row.SetPropertyValue("StadiumCapacity", 45362);
  row.SetPropertyValue("Established", new DateTime(1892, 1, 1));
  dataTable.Add(row);

  // ... additional rows 
}

//2.  An async validation example: Cell validation 
// Hint: Row validation would be similar, but you use some row-event
public async Task ValidateEditedCell(CustomDataRow currentRow)
{
  var columnName = "StadiumCapacity"; // Use your available grid events to get the column name, like CellEditEnd (control-dependent) 
  object? cellValue = currentRow[columnName];
  // Call your async validation method to validate the 'cellValue'
  await Task.Delay(2000); // simulation: Validation took 2 sec
  // The validation method returns 'false'? Add the error to the row:
  currentRow.AddError(columnName, "error message"); // the grid cell would be red marked, and a tool  
}

Result

example

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 111 6/9/2024