avaloniauiavalonia

Namespace and type for Avalonia DataGrid example not found


I'm going through the DataGrid example from: https://docs.avaloniaui.net/docs/reference/controls/datagrid/

I've installed the DataGrid extension (Avalonia.Controls.DataGrid), but the namespace 'AvaloniaControls.Models' is not recognized and the type 'ViewModelBase' is also unknown.

I can't find any documentation on the source of this namespace and type.


Solution

  • The problem seems to be that I created a new Avalonia .NET App instead of a new Avalonia MVVM App. Once I created a project from the MVVM template, the namespace and type were recognized. The MVVM is required for the DataGrid (while most other controls have no such restriction).