为什么使用 ContentStringFormat 时没有使用 AccessText?
Why is AccessText not used when using ContentStringFormat?
当使用字符串值作为 ContentControl(如 Label)的 Content
时,在字符串中使用 _
允许使用以下字母作为访问键,如下所示:
<Label Content="Text with _access key"/>
甚至
<Label Content="{Binding Text}"/>
如果文本是包含 _
.
的字符串 属性
但是,当使用包含 _
的 ContentStringFormat
时,它不再起作用:
<Label Content="{Binding Value}" ContentStringFormat="_Formatted value {0}"/>
我在调试器中看到在这种情况下没有使用 AccessText
。
作为变通方法,我明确地使用了 AccessText
:
<Label>
<AccessText Text="{Binding Value, StringFormat=_Formatted value {0}"/>
</Label>
它是这样工作的,但我仍然想知道为什么在使用 ContentStringFormat
时它不工作。
也许 This 主题会让您对 AccesText
.
有一些了解
当使用字符串值作为 ContentControl(如 Label)的 Content
时,在字符串中使用 _
允许使用以下字母作为访问键,如下所示:
<Label Content="Text with _access key"/>
甚至
<Label Content="{Binding Text}"/>
如果文本是包含 _
.
但是,当使用包含 _
的 ContentStringFormat
时,它不再起作用:
<Label Content="{Binding Value}" ContentStringFormat="_Formatted value {0}"/>
我在调试器中看到在这种情况下没有使用 AccessText
。
作为变通方法,我明确地使用了 AccessText
:
<Label>
<AccessText Text="{Binding Value, StringFormat=_Formatted value {0}"/>
</Label>
它是这样工作的,但我仍然想知道为什么在使用 ContentStringFormat
时它不工作。
也许 This 主题会让您对 AccesText
.