X:在静态UWP XAML [英] x:Static in UWP XAML
本文介绍了X:在静态UWP XAML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我工作的一个应用程序需要一个ConverterParameter是一个枚举。对于这一点,正规的方式做是:
An app I'm working on requires a ConverterParameter to be an enum. For this, the regular way to do would be:
{Binding whatever,
Converter={StaticResource converterName},
ConverterParameter={x:Static namespace:Enum.Value}}
不过,UWP平台X:空间似乎并不具备静态扩展
However, the UWP platform x: namespace does not seem to have the Static extension.
有谁知道,如果有不依赖X上的一个解决方案:静态在结合比较枚举?
Does anyone know if there's a solution that does not rely on x:Static for comparing an enum in binding?
推荐答案
这在UWP对我的作品:
This works for me in a UWP:
<Button Command="{Binding CheckWeatherCommand}">
<Button.CommandParameter>
<local:WeatherEnum>Cold</local:WeatherEnum>
<Button.CommandParameter>
</Button>
这篇关于X:在静态UWP XAML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文