All code and samples could be downloaded from this link.
Whereas engaged on a WPF/XAML software, you probably have wanted to allow/disable or present/cover a management based mostly on a conditional logic utilizing relational operators (e.g: =, !=, >, >=,
I labored on a price converter which lets you bind boolean and visibility dependency properties to conditional logic utilizing relational operators.
Supported relational operators are:
- Equal (=)
- Not Equal (!=)
- Better Than (>)
- Better Than Or Equal (>=)
- Much less Than (
- Much less Than Or Equal (
- Between (a
- Between (a
- Between (a
- Between (a
utilizing System;Utilization:
utilizing System.Collections.Generic;
utilizing System.Linq;
utilizing System.Textual content;
utilizing System.Threading.Duties;
utilizing System.Home windows.Knowledge;
utilizing System.Home windows;
namespace DevelopmentSimplyPut.RelationalOperatorsConverter
public class RelationalOperatorsToBoolConverter : IValueConverter
public object Convert(object worth, Kind targetType, object parameter, System.Globalization.CultureInfo tradition)
'))
string[] components = parameter.ToString().Cut up('
return end result;
public object ConvertBack(object worth, Kind targetType, object parameter, System.Globalization.CultureInfo tradition)
public class RelationalOperatorsToVisibilityConverter : IValueConverter
xmlns:converters="clr-namespace:DevelopmentSimplyPut.RelationalOperatorsConverter;meeting=RelationalOperatorsConverter"
In the event you run the demo software included within the connected code samples, you will see the outcomes under.
That is it. In the event you like this publish you'll be able to depart a remark :)
Good luck.