question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Avalonia Can't find Package

See original GitHub issue

I am trying to implement LiveCharts2 into my project, but keep getting compile errors form the XAML file saying “Unable to resolve type PieChart from namespace using:LiveChartsCore.SkiaSharpView.Avalonia”. The program will run, but it doesn’t display the graphs. I installed LiveCharts from the Package manager console using this line: “Install-Package LiveChartsCore.SkiaSharpView.Avalonia -Version 2.0.0-beta.300”

I set up my view like this:

<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             xmlns:lv="clr-namespace:LiveChartsCore;assembly=LiveChartsCore"
             xmlns:lvc="using:LiveChartsCore.SkiaSharpView.Avalonia"
             x:Class="PowderInventory.InventoryManagement.UI.Views.OperatorView">
	<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
		<TextBlock Text="Hi, this is the operator view" />
		<TextBlock Text="{Binding UrlPathSegment}" />
		
		<lvc:PieChart Series="{Binding Series}" LegendPosition="Right"/>
	</StackPanel>
</UserControl>

and my ViewModel uses the Series data from the sample

public IEnumerable<ISeries> Series { get; set; } = new ISeries[]
         {
             new PieSeries<double> { Values = new double[] { 2 }, Name = "Slice 1" },
             new PieSeries<double> { Values = new double[] { 4 }, Name = "Slice 2" },
             new PieSeries<double> { Values = new double[] { 1 }, Name = "Slice 3" },
             new PieSeries<double> { Values = new double[] { 4 }, Name = "Slice 4" },
             new PieSeries<double> { Values = new double[] { 3 }, Name = "Slice 5" }
         };

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
marcosnathancommented, Oct 7, 2022

Hi. I also was having this issue. CartesianChart was working, but it wasn’t showing on designer preview. I added this to Program.cs in BuildAvaloniaApp method.

GC.KeepAlive(typeof(LiveChartsCore.SkiaSharpView.Avalonia.CartesianChart).Assembly);

0reactions
EricZeibergcommented, May 22, 2023

Having the same issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Avalonia project is giving me a hell of errors!!! : r/dotnet
Unable to find package Avalonia.Desktop. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs.
Read more >
how to resolve "Unable to find package" nuget error
Go to Package Manager Settings (Tools > Nuget Package Manager > Package ... It couldn't find the packages as it was looking for...
Read more >
Avalonia 11.0.4
Avalonia is a cross-platform UI framework for .NET providing a flexible styling system and supporting a wide range of Operating Systems such as...
Read more >
Upgrading from 0.10
Update the Avalonia packages to 11.x; Themes are no longer included in the Avalonia.Desktop package, so you will need to add a package...
Read more >
Avalonia
ReactiveUI Docs. For WhenActivated to work, you need to use custom base classes from Avalonia.ReactiveUI package, such as ReactiveWindow<TViewModel> ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found