Wpf usercontrol加载如何设置焦点 [英] Wpf usercontrol load how to set focus
本文介绍了Wpf usercontrol加载如何设置焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
WPf用户控件加载如何设置foucs。
我尝试过:
加载事件使用textbox.focus()。第一次不能处理页面加载。但按钮单击焦点显示
WPf user control load how to set foucs.
What I have tried:
load event use textbox.focus() . not work on page load at first time. but button click focus is display
推荐答案
您没有向我们展示相关代码,这使得很难建议,但是后续线程应该足以满足您的需求 -
将重点放在wpf中UserControl中的文本框控件上 - Stack Overflow [ ^ ]
将重点放在wpf中UserControl中的文本框控件上 - Stack Overflow [ ^ ]
希望,它有帮助:)
You haven't shown us the relevant code which makes it difficult to suggest but following threads should be sufficient for what you are looking for-
Set focus on a textbox control in UserControl in wpf - Stack Overflow[^]
Set focus on a textbox control in UserControl in wpf - Stack Overflow[^]
Hope, it helps :)
在UserControls中自动设置焦点可能很棘手。这是我找到并使用的最佳解决方案:
第3部分:将焦点转移到WPF中的第一个可用元素 - julmar.com [ ^ ]
Setting focus in UserControls automatically can be tricky. This is the best solution that I have found and use:
Part 3: Shifting focus to the first available element in WPF - julmar.com[^]
终于有了解决方案
添加了usercontrol属性se --- Focusable =false
网格添加属性 -
Focusable =TrueCursor =Hand
Finally Got Solutions
usercontrol property added se --- Focusable="false"
grid add property --
Focusable="True" Cursor="Hand"
这篇关于Wpf usercontrol加载如何设置焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文