diff --git a/PacticeSolution/ListSample/Converter/AgeToRangeConverter.cs b/PacticeSolution/ListSample/Converter/AgeToRangeConverter.cs new file mode 100644 index 0000000..afb24a9 --- /dev/null +++ b/PacticeSolution/ListSample/Converter/AgeToRangeConverter.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace ListSample.Converter +{ + [ValueConversion(typeof(int), typeof(string))] + internal class AgeToRangeConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value == null) + return null; + + return (int)value >= 40 ? "OB Group" : "YB Group"; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + } +} diff --git a/PacticeSolution/ListSample/ListSample.csproj b/PacticeSolution/ListSample/ListSample.csproj index 2c18da2..9530d10 100644 --- a/PacticeSolution/ListSample/ListSample.csproj +++ b/PacticeSolution/ListSample/ListSample.csproj @@ -55,6 +55,7 @@ MSBuild:Compile Designer + True True diff --git a/PacticeSolution/ListSample/MainWindow.xaml b/PacticeSolution/ListSample/MainWindow.xaml index f55b15a..938b650 100644 --- a/PacticeSolution/ListSample/MainWindow.xaml +++ b/PacticeSolution/ListSample/MainWindow.xaml @@ -33,7 +33,7 @@