命名样式和模板 [英] Naming of styles and templates

查看:54
本文介绍了命名样式和模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Blend4或Blend5中打开的WPF项目中,我在usercontrol中使用以下元素。 style属性设置为"HLK_Klappe"

In an WPF project opened in Blend4 or Blend5 I am using the following element in an usercontrol. The style property is set to "HLK_Klappe"

<vih:VisuState x:Name="Shutter_Invert" Content="xxx" Margin="549,59,0,0" VerticalAlignment="Top" Style="{DynamicResource HLK_Klappe}" Height="80" Width="32" State="{Binding SelectedValue.Key, ElementName=StatesList}" Status="{Binding SelectedValue.Key, ElementName=StatusList}" CmdPriority="{Binding SelectedValue.Key, ElementName=PriorityList}" Invert="True" HorizontalAlignment="Left"/>

如果我使用bredcrumb tabcontrol,我会看到以下代码:

In the If I use the bredcrumb tabcontrol, I see the following code:

<Style x:Key="HLK_Klappe" TargetType="{x:Type vih:VisuState}"> <Setter Property="Width" Value="32"/> <Setter Property="Height" Value="88"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type vih:VisuState}">

....


但是如果我在设计师视图中使用编辑模板 - 应用资源,我会看到" <强> HLKKlappe "缺少下划线(_)。

But if I use Edit Template - Apply Resource in the designer view, I see "HLKKlappe" with missing underscore (_).

这段文字的来源是什么,为什么是下划线(_)缺少?

推荐答案

我认为这是因为_字符用于表示菜单项的加速键。例如,文件菜单被定义为"_File",编辑为"_Edit",等等。由于您的样式名称用作菜单文本,因此它可能会将_ b $ b解释为_,就好像它应该表示加速键一样。 
I believe this is because the _ character is used to denote the accelerator key for a menu item. For example, the file menu is defined as "_File", edit as "_Edit", and so on. Because the name of your style is used as the menu text, it likely interprets the _ as if it should denote the accelerator key. 


这篇关于命名样式和模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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