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

Not supported in Avalonia 11-preview4 #5

Open
TimB-rain opened this issue Dec 1, 2022 · 37 comments
Open

Not supported in Avalonia 11-preview4 #5

TimB-rain opened this issue Dec 1, 2022 · 37 comments

Comments

@TimB-rain
Copy link

After updating from Avalonia 10 to Avalonia 11-preview4 we have the exception in compiler

SettingsViewModel.cs(26, 34): [CS0012] The type 'IResourceProvider' is defined in an assembly that is not referenced. You must add a reference to assembly 'Avalonia.Styling, Version=0.10.18.0, Culture=neutral, PublicKeyToken=c8d484a7012f9a8b'.

using Avalonia;
using Avalonia.Styling;
using NP.Avalonia.Visuals.Behaviors;
using NP.Avalonia.Visuals.ThemingAndL10N;
using ReactiveUI;
using System;
using System.Reflection;
using System.Threading.Tasks;

namespace QxCode.Projector.Desktop.ViewModels {
    public class SettingsViewModel : ViewModelBase {
        private readonly IWindowsService _ws;
        private readonly ThemeLoader _languageThemeLoader;

        public SettingsViewModel(IWindowsService ws) {
            //some code
            _languageThemeLoader=Application.Current?.Resources.GetThemeLoader("LanguageLoader")!;
            //some code
        }
        //some code
}
@TimB-rain
Copy link
Author

Could you please recompile libraries with last version of Avalonia? I have problems with compilation

@npolyak
Copy link
Owner

npolyak commented Dec 1, 2022

I plan to port it soon.

@TimB-rain
Copy link
Author

Great! Thanks!)

@Abdesol
Copy link

Abdesol commented Feb 13, 2023

I plan to port it soon.

Still, I am not able to make it work on preview 4

@npolyak
Copy link
Owner

npolyak commented Feb 13, 2023

Hey, sorry, when I said that I'll port it soon, I was told by some people at Avalonia that the 11 RC is coming in December 22 while the full version is coming in Jan. Now they have a very different schedule and they are actually not sure when they are moving to 11 RC and full version. So, I decided to wait longer. I do not have bandwidth to support both versions at the same time. Regards.

@npolyak
Copy link
Owner

npolyak commented Feb 13, 2023

take a look at AvaloniaUI/Avalonia#2239 (comment)

@DigitalAdeel
Copy link

same question here. had to update to preview5 and now can't do localization cuz of that same error

@npolyak
Copy link
Owner

npolyak commented Feb 17, 2023

Hey DigitalAdeel,
I read that preview5 has a lot of bugs, so I would not want to convert my libraries to a buggy version. Let us wait for 11 RC and I'll convert my libraries several days after.

@npolyak
Copy link
Owner

npolyak commented Feb 17, 2023

Here it is: AvaloniaUI/Avalonia#10193 (comment)
I quote:
"Preview 5 has more issues than any of the previous previews and I'm seeing quite a few more-fundamental problems with controls just not rendering correctly along with various crashes. This is going to get fixed, it's just going to take a bit"

@DigitalAdeel
Copy link

Problem with Preview4 is that libvlcsharp gives Avalonia.Styling error if I use preview4 and problem with 0.10.18 is that I can't force it to use dark theme not according to sytem's theme color.
Is there any property like RequestedThemeVariant? If yes, then I'll be able to downgrade back to 0.10.18

@DigitalAdeel
Copy link

Cuz my client only wants black color for background, I need to force it to use dark theme only.

@npolyak
Copy link
Owner

npolyak commented Feb 17, 2023

For Avalonia built in themes in 0.10.18 version - yes there are ways to switch between light and dark for both Fluent and Default themes. For fluent theme - there is a property Mode that you can change between Light and Dark, e.g.

<Application xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             x:Class="SimpleAvaloniaApp.App">
    <Application.Styles>
        <FluentTheme Mode="Light"/>
    </Application.Styles>
</Application>

For Default theme - it is done differently, by switching between BaseLight.xaml and BaseDark.xaml, e.g

<Application xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             x:Class="NP.Demos.DragBehaviorSample.App">
    <Application.Styles>
        <StyleInclude Source="avares://Avalonia.Themes.Default/Accents/BaseDark.xaml" />
        <StyleInclude Source="avares://Avalonia.Themes.Default/DefaultTheme.xaml" />
    </Application.Styles>
</Application>

using avares://Avalonia.Themes.Default/Accents/BaseDark.xaml will produce dark theme, while using avares://Avalonia.Themes.Default/Accents/BaseLight.xaml will produce light theme.

@npolyak
Copy link
Owner

npolyak commented Feb 17, 2023

in version 11 - built-in theming is different, BTW.

@DigitalAdeel
Copy link

Anyway to force dark theme in 0.10.18?

@DigitalAdeel
Copy link

DigitalAdeel commented Feb 17, 2023

image
As you can see, my client sent me buglist yesterday and mentions about it cuz he's using light theme on his pc and I'm using dark

@npolyak
Copy link
Owner

npolyak commented Feb 17, 2023

yes, see my comment above.

@npolyak
Copy link
Owner

npolyak commented Feb 17, 2023

it is all about 0.10.18

@DigitalAdeel
Copy link

sorry, missed it somehow 😅

@npolyak
Copy link
Owner

npolyak commented Feb 17, 2023

np:)

@DigitalAdeel
Copy link

Well, I tried with setting it's mode to dark but it was still switching to light theme

@DigitalAdeel
Copy link

:(

@DigitalAdeel
Copy link

I got old backup with 0.10.18 version, so I'll test it again

@DigitalAdeel
Copy link

tested but as you can see, still light theme even I set it to dark with 0.10.18 :(
image

@npolyak
Copy link
Owner

npolyak commented Feb 17, 2023

looks dark to me - background is dark and foreground is light. To apply the theme globally, put it into App.axaml file.

@DigitalAdeel
Copy link

Same issue with putting em in App.axaml
image

image
151-06877754-86ef-4e3a-8045-26b14d6e4b32.png)

@DigitalAdeel
Copy link

and why background is dark cuz as I said earlier client wants black bg
image

@DigitalAdeel
Copy link

in preview5, all I had to was to set RequestedThemeVariant property to Dark

@npolyak
Copy link
Owner

npolyak commented Feb 17, 2023

I am sorry, I am not supporting Avalonia. I am not part of Avalonia team. Based on the quote about 11.preview-5 version you should not be switching to it yet. You can create your own custom theme and change the background the way you want. Take a look the way it is done in Avalonia.

@DigitalAdeel
Copy link

Okay. Thanks for your help :)

@DigitalAdeel
Copy link

Well, I'm gonna play some witcher 3 now 😂

@npolyak
Copy link
Owner

npolyak commented Feb 17, 2023

not a problem :)

@DigitalAdeel
Copy link

@npolyak Hi, btw was able to find the culprit behind it.
It was FluentAvaloniaTheme's PrefereSystemTheme property and setting it to False fixed it 😁

image

@DigitalAdeel
Copy link

DigitalAdeel commented Mar 24, 2023

@npolyak Now, no need to wait for Avalonia 11 to become stable 😂

image

Edit: I added Remember Password checkbox when I was using Avalonia 11, so now gonna add string for it in Resource Files 😅

@TETYYS
Copy link

TETYYS commented Apr 11, 2023

preview6 is out, is it possible to get it updated?

@DigitalAdeel
Copy link

preview6 is out, is it possible to get it updated?

Same question here cuz we don't how much time it's gonna take before Avalonia 11 becomes stable

@Kokoreff081
Copy link

So, Avalonia 11 now released, any information about updating your package?

@blahetal
Copy link

Avalonia is out 11.0.1, @npolyak could you update the package please

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

7 participants