Skip to content

Critical changes when upgrading from 3.1.1 to 4.0

Dmitry Zhutkov edited this page Feb 18, 2024 · 1 revision

Since the release of PleasantUI 4.0, some features have changed. Please familiarize yourself with these changes:

Styles

The style of the user interface has changed significantly.

Whereas the UI used to be similar to Windows 11, now it's kind of trying to be similar but has its own unique styles.

Brush keys have also changed and old ones have been removed, check out the new full list below:

  • TextFillColor1Brush

  • TextFillColor2Brush

  • TextFillColor3Brush

  • ControlFillColor1Brush

  • ControlFillColor2Brush

  • ControlFillColor3Brush

  • ControlBorderColorBrush

  • ContentBorderColorBrush

  • BackgroundColor1Brush

  • BackgroundColor2Brush

  • BackgroundColor3Brush

  • BackgroundColor4Brush

  • ControlColor1Brush

  • ControlColor2Brush

  • ControlColor3Brush

  • SystemFillColorCriticalBrush

  • SystemFillColorSuccessBrush

  • SystemFillColorCautionBrush

  • SystemFillColorNeutralBrush

  • DangerColorBrush

  • BorderDangerColorBrush

  • SelectedDangerColorBrush

  • TextFillColorDangerBrush

  • FocusStrokeColorOuterBrush

  • FocusStrokeColorInnerBrush

Connecting a library to an application

If you had to spell out the creation of PleasantTheme in the App.axaml.cs file, you don't need to do that now. You just need to plug PleasantTheme into App.axaml. Note that the initialization of the application must be correct. See example:

using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using YourApplication.ViewModels;
using YourApplication.Views;

namespace YourApplication;

public partial class App : Application
{
    // That's exactly what you need to do, as shown below
    public override void Initialize()
    {
        AvaloniaXamlLoader.Load(this);
    }

    public override void OnFrameworkInitializationCompleted()
    {
        if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
        {
            desktop.MainWindow = new MainWindow
            {
                DataContext = new MainWindowViewModel(),
            };
        }

        base.OnFrameworkInitializationCompleted();
    }
}

(Desktop only) You don't have to manually save the library settings, the library can save them itself.

If you change the theme or accent color, you don't have to call an additional method to update the app's theme.

Controls

NavigationViewItemBase has been removed and a regular NavigationViewItem will be used.

Icons

PleasantUI now uses Material Design icons. Previously, Fluent Design icons were used. It's also possible that the icon keys have been changed if you're using them.

Clone this wiki locally