Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception in oxyplot.Avalonia's StyleInclude #65

Open
guilhermeolisi opened this issue Jan 24, 2024 · 3 comments
Open

Exception in oxyplot.Avalonia's StyleInclude #65

guilhermeolisi opened this issue Jan 24, 2024 · 3 comments

Comments

@guilhermeolisi
Copy link

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

@nicolasr75
Copy link

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?

@v3ssel
Copy link

v3ssel commented Mar 8, 2024

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

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

@lloydjatkinson
Copy link

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.		

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants