WPF 在标签元素中给字母加下划线 [英] WPF Underline a letter in a label element

查看:87
本文介绍了WPF 在标签元素中给字母加下划线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在带有快捷键的文本框旁边有一个标签.标签的 XAML 如下所示:

I have a label next to a text box which has a short cut key. The XAML for the label looks like:

<Label>Enter your _Name</Label>

如果你按 alt+N,它会在你输入姓名的文本框中设置焦点.

Where if you press alt+N it sets focus in the textbox where you would enter your name.

我希望字母 N 带有下划线,这样当用户看到标签时,它看起来像:

I'd like the letter N to be underlined so that when the user sees the label it looks like:

输入您的 N 名称(这里 N 是粗体,但我希望它有下划线 :))

Enter your Name (well N is bold here, but I'd like it be underlined :))

感谢您的帮助!

推荐答案

按下 Alt 键时,N 将自动加下划线.您会在任何 Windows 应用程序中看到这种行为,因为它是系统范围的设置.

The N will automatically be underlined when the Alt key is pressed. You'll see this behavior in any Windows application as it's a system-wide setting.

如果您想在不按 Alt 的情况下始终获得下划线,请转到控制面板中的轻松访问"中心并选中下划线键盘快捷键和访问键".

If you want to always get the underline without having to press Alt, go to the Ease of Access center in the control panel and check "underline keyboard shortcuts and access keys".

这篇关于WPF 在标签元素中给字母加下划线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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