wieslawsoltes / avalonia.thememanager Goto Github PK
View Code? Open in Web Editor NEWTheme manager for Avalonia applications.
License: MIT License
Theme manager for Avalonia applications.
License: MIT License
This may be more a framework feature than this library can offer but is there an easy way to change icons based on theme?
I most use dark grey icons by default and with a light theme they work ok, however on dark theme they are barely visible
What is the best approach to solve this? Bind all icons and do some behind code?
Compilation error with avalonia version bigger than 0.10.999-cibuild0011401-beta.
Can we have a new night version?
ThemeSelector
does not exist
//Open new window
public void button_Click(object sender, RoutedEventArgs e)
{
TestWindow testWindow = new TestWindow();
testWindow.Show();
}
public class TestWindow : Window
{
public TestWindow()
{
this.InitializeComponent();
this.AttachDevTools();
App.Selector?.EnableThemes(this); // Error The Style already has a parent.
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
I cloned the project and opened in VS 2022 (V17.7.5) on Windows 10. I have .NET SDK 7.0.402 installed.
I set AvaloniaApp as my startup project and when I run, it crashes at:
System.ArgumentNullException
HResult=0x80004003
Message=Value cannot be null. (Parameter 'key')
Source=System.Private.CoreLib
StackTrace:
at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
at System.Collections.Generic.Dictionary2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) at System.Collections.Generic.Dictionary
2.set_Item(TKey key, TValue value)
at Avalonia.Controls.ResourceDictionary.set_Item(Object key, Object value)
at AvaloniaApp.ColorPage.OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) in C:\git\Avalonia.ThemeManager\samples\AvaloniaApp\ColorPage.axaml.cs:line 57
at Avalonia.AvaloniaObject.OnPropertyChangedCore(AvaloniaPropertyChangedEventArgs change)
at Avalonia.Animation.Animatable.OnPropertyChangedCore(AvaloniaPropertyChangedEventArgs change)
at Avalonia.AvaloniaObject.RaisePropertyChanged[T](AvaloniaProperty1 property, Optional
1 oldValue, BindingValue1 newValue, BindingPriority priority, Boolean isEffectiveValue) at Avalonia.PropertyStore.EffectiveValue
1.SetAndRaiseCore(ValueStore owner, StyledProperty1 property, T value, BindingPriority priority, Boolean isOverriddenCurrentValue, Boolean isCoercedDefaultValue) at Avalonia.PropertyStore.EffectiveValue
1.SetLocalValueAndRaise(ValueStore owner, StyledProperty1 property, T value) at Avalonia.PropertyStore.ValueStore.SetLocalValue[T](StyledProperty
1 property, T value)
at Avalonia.PropertyStore.LocalValueBindingObserverBase1.<OnNext>g__Execute|15_0(LocalValueBindingObserverBase
1 instance, BindingValue1 value) at Avalonia.PropertyStore.LocalValueBindingObserverBase
1.OnNext(BindingValue1 value) at Avalonia.PropertyStore.LocalValueBindingObserver
1.OnNext(Object value)
at Avalonia.Reactive.LightweightObservableBase1.PublishNext(T value) at Avalonia.Data.Core.BindingExpression.InnerListener.OnNext(Object value) at Avalonia.Reactive.LightweightObservableBase
1.PublishNext(T value)
at Avalonia.Data.Core.ExpressionObserver.ValueChanged(Object value)
at Avalonia.Data.Core.ExpressionNode.ValueChanged(Object value, Boolean notify)
at Avalonia.Data.Core.ExpressionNode.ValueChanged(Object value)
at Avalonia.Data.Core.Plugins.PropertyAccessorBase.PublishValue(Object value)
at Avalonia.Data.Core.Plugins.InpcPropertyAccessorPlugin.Accessor.SendCurrentValue()
Using the latest master, switching to a Fluent theme when running AvaloniaApp results in an unhandled exception:
System.Reflection.TargetInvocationException: 'Exception has been thrown by the target of an invocation.'
Inner Exception
KeyNotFoundException: Static resource 'SystemControlBackgroundAccentBrush' not found.
Adding these includes to App.axaml:
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Accents/Base.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Accents/BaseLight.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Accents/BaseDark.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Accents/AccentColors.xaml"/>
Fixes the error, but certain elements (the calendar, certain pieces of text, etc.) will always use whichever fluent style was included last, rather than using the selected one.
(Running on Win10, VS2022)
From Example 2, the item is not available. When compiling Core2D. Sampling doesn't work there either.
[Binding] Error in binding to "Avalonia.Controls.MenuItem"."Command": "Could not find CLR property 'ApplyTheme' on 'Avalonia.ThemeManager.Theme'" (Avalonia.Controls.MenuItem #39696553)
[Binding] Error in binding to "Avalonia.Controls.MenuItem"."Command": "Could not find CLR property 'ApplyTheme' on 'Avalonia.ThemeManager.Theme'" (Avalonia.Controls.MenuItem #63406242)
[Binding] Error in binding to "Avalonia.Controls.MenuItem"."Command": "Could not find CLR property 'ApplyTheme' on 'Avalonia.ThemeManager.Theme'" (Avalonia.Controls.MenuItem #511887)
[Binding] Error in binding to "Avalonia.Controls.MenuItem"."Command": "Could not find CLR property 'ApplyTheme' on 'Avalonia.ThemeManager.Theme'" (Avalonia.Controls.MenuItem #3048957)
If use {Binding ThemeSelected.ApplyTheme}
[Binding] Error in binding to "Avalonia.Controls.MenuItem"."Header": "Could not find CLR property 'Name' on 'Avalonia.ThemeManager.ThemeSelector'" (Avalonia.Controls.MenuItem #51198184)
[Binding] Error in binding to "Avalonia.Controls.MenuItem"."Command": "Could not find CLR property 'ThemeSelected' on 'Avalonia.ThemeManager.ThemeSelector'" (Avalonia.Controls.MenuItem #51198184)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.