Hi Zhan,
Just like what UE4 editor, You need to get the Primitive in C++ and call UPrimitiveComponent::SetDepthPriorityGroup(). Normally, all primitives are render in SDPG_World, but all UI or highlight primitive should render in SDPG_Foreground. You can search these key words to see how it works in UE4 editor code.
Cheers,
Jin Yaping