简体   繁体   English

KeyBinding.Keyvalue =“ F6”无法从资源文件c#中读取此值

[英]KeyBinding.Keyvalue=“F6” Cant i read this value from resource File c#

I am trying to read the value like this <KeyBinding Key="{x:Static prop:Resources.F6}" it gives me an error Invalid type. 我试图读取像这样的值<KeyBinding Key="{x:Static prop:Resources.F6}"它给我一个错误无效类型。 It works when it is <KeyBinding Key="F6" 它在<KeyBinding Key="F6"

Any ideas or reason for this is appreciated 任何想法或原因的赞赏

As MSDN states, the KeyBinding.Key property is of the enum type Key . MSDN所述, KeyBinding.Key属性的枚举类型为Key WPF will convert the string "F6" to Key.F6. WPF会将字符串“ F6”转换为Key.F6。 Unless your Resources.F6 property also returns a Key enumeration, this will not work. 除非您的Resources.F6属性也返回Key枚举,否则它将不起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM