Cannot set background color to border in code

I solved it. Check below link.

Declare FSlateBrush at header, not .cpp source file. And if you use it to fill background, color will apply with no problem

.h

//....
FSlateColorBrush brush = FSlateColorBrush(FLinearColor::Yellow);
//....

.cpp

SNew(SBorder)
    .VAlign(VAlign_Center)
    .HAlign(HAlign_Center)
    .BorderImage(&brush)  
//...

Result

253141-answer.png

Hope this helps who is trying to use slate in code.

4 Likes