oxyplot-avalonia icon indicating copy to clipboard operation
oxyplot-avalonia copied to clipboard

Exception in oxyplot.Avalonia's StyleInclude

Open guilhermeolisi opened this issue 1 year ago • 5 comments

Hey,

I'm trying to update my project to Avalonia 11, but I had some problems with the Oxyplot.Avalonia nuget package. On the oxyplot-avalonia main page on github there is an instruction for using oxyplot with Avalonia 11 which I think is wrong, it says AvaloniaEdit in StyleInclude (see screenshot below)

image

I've read the oxyplot.Avalonia examples and they use the code below to include the style:

StyleInclude Source="avares://OxyPlot.Avalonia/Themes/Default.axaml"/>

But in my project I get the following exception in this code: No precompiled XAML found for avares://OxyPlot.Avalonia/Themes/Default.axaml (baseUri: avares://Nimloth/App.axaml), make sure to specify x:Class and include your XAML file as AvaloniaResource

I'm using the latest version of the oxyplot.avalonia nuget package, 2.1.0, and Avalonia 11.0.6

guilhermeolisi avatar Jan 24 '24 01:01 guilhermeolisi

I'm on Avalonia 11.07 and also having trouble to get it working. This is a blank project where I only added Oxyplot.Avalonia 2.1.0.

I'm also using

StyleInclude Source="avares://OxyPlot.Avalonia/Themes/Default.axaml"/>

This is the only line I have yet added and the error is:

AVLN:0004 Resource "avares://OxyPlot.Avalonia/Themes/Default.axaml" is defined as "OxyPlot.Avalonia.Themes.Default" type in the "OxyPlot.Avalonia" assembly, but expected "Avalonia.Styling.IStyle". Line 9, position 17. AvaloniaApplication1 9

Any ideas?

nicolasr75 avatar Jan 30 '24 19:01 nicolasr75

Had the same issue, change package reference to 2.1.0-Avalonia11 helps me

dotnet add package Oxyplot.Avalonia --version 2.1.0-Avalonia11

v3ssel avatar Mar 08 '24 23:03 v3ssel

Even with that version and the following code I get exceptions and build errors. How did you resolve it?

    <Application.Styles>
        <StyleInclude Source="avares://Avalonia.Themes.Default/DefaultTheme.xaml" />
        <StyleInclude Source="avares://Avalonia.Themes.Default/Accents/BaseLight.xaml" />

        <!--  Add the line below to get OxyPlot UI theme applied.  -->
        <StyleInclude Source="resm:OxyPlot.Avalonia.Themes.Default.xaml?assembly=OxyPlot.Avalonia" />

        <!--  Add the line below to get OxyPlot UI theme applied in Avalonia 11.  -->
        <StyleInclude Source="avares://AvaloniaEdit/Themes/Simple/AvaloniaEdit.xaml" />
        <SimpleTheme />
    </Application.Styles>
Assembly "Avalonia.Themes.Default" was not found from the "avares://Avalonia.Themes.Default/DefaultTheme.xaml" source. Line 8, position 23.		

lloydjatkinson avatar Mar 28 '24 21:03 lloydjatkinson