Search code examples
c#enumswindows-10uwp

x:Static in UWP XAML


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?


Solution

  • This works for me in a UWP:

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