Is it possible to create a generic Int-to-Enum Converter?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'd like to be able to say <DataTrigger Binding="{Binding SomeIntValue}" Value="{x:Static local:MyEnum.SomeValue}"> and to have it resolve as True if the int value is equal to (int)MyEnum.Value I know I could make a Converter that returns (MyEnum)intValue , however then I'd have to make a converter for every Enum type I use in my DataTriggers. Is there a generic way to create a converter that would give me this kind of functionality? 回答1: It is possible to create a converter between enum values and their underlying integral types in a