Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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}}

However, the UWP platform x: namespace does not seem to have the Static extension.

Does anyone know if there's a solution that does not rely on x:Static for comparing an enum in binding?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
633 views
Welcome To Ask or Share your Answers For Others

1 Answer

This works for me in a UWP:

<Button Command="{Binding CheckWeatherCommand}">
  <Button.CommandParameter>
     <local:WeatherEnum>Cold</local:WeatherEnum>
  <Button.CommandParameter>
</Button>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...