DataGrid: Could not resolve type DataGridCell
See original GitHub issueI am using Avalonia and DataGrid (0.8.0). Including DataGrid theme into the application provokes the following error:
Error loading xaml at resm:Avalonia.Controls.DataGrid.Themes.Default.xaml?assembly=Avalonia.Controls.DataGrid: Could not convert object 'DataGridCell' (of type System.String) to {clr-namespace:Avalonia.Styling;assembly=Avalonia.Styling}Selector: Could not resolve type 'DataGridCell'
.csproj
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.8.0" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="0.8.0" />
</ItemGroup>
App.xaml
<Application xmlns="https://github.com/avaloniaui">
<Application.Styles>
<StyleInclude Source="avares://Avalonia.Themes.Default/DefaultTheme.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Accents/BaseLight.xaml" />
<StyleInclude Source="resm:Avalonia.Controls.DataGrid.Themes.Default.xaml?assembly=Avalonia.Controls.DataGrid" />
</Application.Styles>
</Application>
The following workaround exists: execute some code to make sure Avalonia.Controls.DataGrid is loaded before using AvaloniaXamlLoader.
App.xaml.cs
public override void Initialize()
{
var dataGridType = typeof(DataGrid); // HACK
AvaloniaXamlLoader.Load(this);
}
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
Top Results From Across the Web
XAML Datagrid Cell Select style not working
I'm unable to get a datagrid cell select style to work under certain conditions. I have the following style:
Read more >Mastering Windows Presentation Foundation: Build responsive ...
If the cell content is valid, we cast its Parent property value to its actual type of DataGridCell. If this DataGridCell object is...
Read more >Pro WPF in VB 2010: Windows Presentation Foundation in .NET 4
Like an ordinary list control, the DataGrid lets the user select individual items. You can react to the SelectionChanged event when this happens....
Read more >Pro WPF 4.5 in C#: Windows Presentation Foundation in .NET 4.5
To find out which data object is currently selected, you can use the ... When this property is true, users can't edit anything....
Read more >How to make WPF DataGrid click Enter key to auto move ...
If cell "4" is last row, click Enter key to move to next row and next row does not exist, the DataGrid will...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The
UseDataGrid
method is now no longer needed since #2322 so closing.Also works with Avalonia.Svg.Skia.Svg for