UIToolkit UIElements, how to access the hover uss style from code?

Hi, I want to do UI Toolkit Editor Window from pure code without USS/Style sheets/UXML/other wierd things. I simply prefer code.

How do I access in Code the uss hover property ?

.quicktool-button-icon:hover {
    opacity: 1;
}

I can’t find these psudo classes, in code.

any help appreciated

1 Answer

1

I have found a way to do it, 1 hour after posting the question

Button button = new Button();
button.RegisterCallback<MouseOverEvent>((type) =>
{
    buttonIcon.style.opacity = 1f;
});

button.RegisterCallback<MouseOutEvent>((type) =>
{
    buttonIcon.style.opacity = 0.5f;
});