How to bind UMG function in C++ (specifically, Brush)?

In Blueprint, it’s possible to create function bindings for certain properties of UI objects. How can I make these same bindings in C++? For sake of completeness, I’d like to know how to bind from C++ to a C++ function and how to bind from Blueprint (well, from the editor as seen below) to a C++ function.

In my case, I’m looking specifically for how to create a binding for the brush, but I imagine it will be the same for everything.

Note: I am not talking about meta=(BindWidget) which is for linking widget properties.

This work:

FSlateBrush UCButton::UpdateBrush()
{
return slateBrush;
}

UFUNCTION()
FSlateBrush UpdateBrush();

border->BackgroundDelegate.BindDynamic(this, &UCButton::UpdateBrush);

border->BrushColorDelegate(…);

1 Like