BringToFront in WPF

后端 未结 5 1039
小鲜肉
小鲜肉 2020-12-17 14:54

I need to bring to front a custom control in WPF.

pseudoCode

OnMouseDown()
{
    if (this.parent != null)
        this.parent.BringToFront(this);
}
<         


        
5条回答
  •  误落风尘
    2020-12-17 15:02

    I've only tested for a Window control but...

    this.Topmost = true;
    this.Topmost = false;
    

    The first line brings it to the front, the second line stops it from being permanently on front.

提交回复
热议问题