Reputation:
I'm running Avalonia UI on .NET Core for Linux (Fedora).
I've followed this tutorial for the DataGrid, but honestly I've added the package with the following command, instead of manually updating the .csproj
.
dotnet add package Avalonia.Controls.DataGrid
After a dotnet restore
and a dotnet run
, I can't see any DataGrid.
Anyway xaml
<StackPanel>
<DataGrid AutoGenerateColumns="True" Items="{Binding People}"/>
</StackPanel>
and ViewModel look fine.
public ObservableCollection<Person> People { get; }
public MainWindowViewModel()
{
People = new ObservableCollection<Person>(GenerateMockPeopleTable());
}
How can I find what is going wrong?
Upvotes: 1
Views: 2399
Reputation:
I forgot to apply the DataGrid
style in the App.xaml (because I'm used to WPF in Windows where the DataGrid
is a standard Control):
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Default.xaml"/>
The tutorial clearly states this step, so in conclusion I only changed the way to add the package in the project, just to get last version of the package reference.
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.9.9" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="0.9.9" />
<PackageReference Include="Avalonia.Desktop" Version="0.9.9" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.9.9" />
</ItemGroup>
Aside for the version number, which obvioulsy changes with time, I can confirm that all is perfect in the above said tutorial.
Upvotes: 5