Skip to content
Discussion options

You must be logged in to vote

Tinkering a bit more, i found a suitable and clean solution (or so i believe) by creating a custom attached property that allows assigning style-class bindings in a XAML style declaration. Below is my code implementing the attached property. Note however that i am rather inexperienced with Avalonia, and my current implementation might have issues i am not (yet) aware of.

public sealed class Classes : AvaloniaObject
{
    static Classes()
    {
        ClassBindingsProperty.Changed.AddClassHandler<StyledElement, ClassBindings>(OnClassBindingsChanged);
    }

    private Classes() {}


    //
    // Attached property to allow defining class bindings in styles
    //
    public static readon…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by elgonzo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant