C#WPF控制顺序Bringtofront/sendtoback [英] C# WPF Control Order Bringtofront/sendtoback

查看:443
本文介绍了C#WPF控制顺序Bringtofront/sendtoback的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对此代码有疑问

I have a problem with this code

textbox1.bringtofront();



它与胜利形式一起使用时效果很好,但是在WPF中却不知道它是什么!



it works very well with win forms but in WPF''s it doesn''t know what it is!

can some convert this code that WPF understands?

推荐答案

如果textbox1是Panel的子级...

您可以使用Panel.ZIndex附加属性,通过为其提供比其同级更高的ZIndex值,将文本框的位置设置为Z顺序的顶部.

如果Panel.ZIndex值对于所有Panel的子代都是相同的,则Panels Children集合中元素的顺序将确定Z顺序.将文本框移到Children集合的末尾,以使其位于Z顺序的顶部.
If textbox1 is a child of a Panel...

You can use the Panel.ZIndex attached property to set the textbox''s position to the top of the Z-order by giving it a higher ZIndex value than its siblings.

If the Panel.ZIndex value is the same for all the Panel''s children then the order of the elements in the Panel''s Children collection determines the Z-order. Move the textbox to the end of the Children collection to bring it to the top of the Z-order.


这篇关于C#WPF控制顺序Bringtofront/sendtoback的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆