如何使用wpf托盘通知将文本框聚焦在wpf中 [英] how to focus textbox in wpf using wpf tray notification

查看:117
本文介绍了如何使用wpf托盘通知将文本框聚焦在wpf中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过 hardcodet.net使用托盘通知»WPF NotifyIcon



使用该代码我显示了自定义那个气球中的气球包含几个控件。

问题是文本框没有集中在自定义气球任何人帮助我

谢谢。

解决方案

你有没有试过



texbox.focus(); ?



试试这个



FocusManager.SetFocusedElement(parentElement,textbox)



和xaml



 <   StackPanel     FocusManager.FocusedElement   =  {Binding ElementName = Box} >  
< TextBox 名称 = Box / >
< / StackPanel >


i'm using the tray notification through hardcodet.net » WPF NotifyIcon

using the that code i'm shown the custom ballon in that ballon contains several controls.
the problem is text box not focused on the custom ballon any one help me
thank you.

解决方案

did you try

texbox.focus(); ?

try this

FocusManager.SetFocusedElement(parentElement, textbox)

and in xaml

<StackPanel FocusManager.FocusedElement="{Binding ElementName=Box}">
   <TextBox Name="Box" />
</StackPanel>


这篇关于如何使用wpf托盘通知将文本框聚焦在wpf中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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