Domanda

I'm not that good with XAML but I want to have a data-trigger which is bound to a variable on my page.cs which is a double.

If the double is bigger than 0.25, I want it to trigger. If it's 0.5 I want another one to trigger.

How would you do this kind of stuff? Any pages to read up on this would be awesome

È stato utile?

Soluzione

You can use converters implementing IValueConverter interface which convert double to bool, based on a value of converter parameter.

For example a converter DoubleMoreThanConverter would accept double value, double converter parameter and return bool in Convert method. You can set Converter and ConverterParameter properties of a binding you put into DataTrigger.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top