腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
工具
TVP
最新优惠活动
文章/答案/技术大牛
搜索
搜索
关闭
发布
精选内容/技术社群/优惠产品,
尽在小程序
立即前往
首页
标签
uwp
#
uwp
关注
专栏文章
(21)
技术视频
(0)
互动问答
(1)
X:UWP XAML中的Static?
2
回答
static
、
uwp
、
xaml
、
解决方案
、
开发
应用案例分享
在UWP上没有静态标记扩展(也没有WinRT平台)。 可能的解决方案之一是创建类,将枚举值作为属性,并将该类的实例存储在ResourceDictionary中。 例子: public enum Weather { Cold, Hot } 下面是具有枚举值的类: public class WeatherEnumValues { public static Weather Cold { get { return Weather.Cold; } } public static Weather Hot { get { return Weather.Hot; } } } 在你的资源字典中: <local:WeatherEnumValues x:Key="WeatherEnumValues" /> 如下: "{Binding whatever, Converter={StaticResource converterName}, ConverterParameter={Binding Hot, Source={StaticResource WeatherEnumValues}}}" />...
展开详请
赞
0
收藏
0
评论
0
分享
在UWP上没有静态标记扩展(也没有WinRT平台)。 可能的解决方案之一是创建类,将枚举值作为属性,并将该类的实例存储在ResourceDictionary中。 例子: public enum Weather { Cold, Hot } 下面是具有枚举值的类: public class WeatherEnumValues { public static Weather Cold { get { return Weather.Cold; } } public static Weather Hot { get { return Weather.Hot; } } } 在你的资源字典中: <local:WeatherEnumValues x:Key="WeatherEnumValues" /> 如下: "{Binding whatever, Converter={StaticResource converterName}, ConverterParameter={Binding Hot, Source={StaticResource WeatherEnumValues}}}" />
热门
专栏
新智元
8.8K 文章
210 订阅
walterlv - 吕毅的博客
651 文章
46 订阅
林德熙的博客
2.1K 文章
62 订阅
sofu456
352 文章
29 订阅
小孙同学的学习笔记
50 文章
16 订阅
领券