From ba2c7db0f3c1abd55663b9bd8b566a54a78641ce Mon Sep 17 00:00:00 2001 From: bombom_by Date: Mon, 12 Aug 2019 00:31:58 +0100 Subject: [PATCH] #91: Sorting tags alphabetically by default --- gui/Controls/Converters.cs | 22 ++++++++++++++++++++++ gui/Controls/TagsControl.xaml | 8 ++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/gui/Controls/Converters.cs b/gui/Controls/Converters.cs index f5235297..04bf1f37 100644 --- a/gui/Controls/Converters.cs +++ b/gui/Controls/Converters.cs @@ -1,6 +1,8 @@ using System; +using System.Collections.Generic; using System.Globalization; using System.IO; +using System.Linq; using System.Net; using System.Text; using System.Windows; @@ -239,4 +241,24 @@ public override ValidationResult Validate(object value, CultureInfo cultureInfo) return validationResult; } } + + + public class TagListConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is List) + { + List tags = value as List; + return tags.OrderBy(tag => tag.Name); + } + return null; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return null; + } + } + } diff --git a/gui/Controls/TagsControl.xaml b/gui/Controls/TagsControl.xaml index d862eb1c..b19426f2 100644 --- a/gui/Controls/TagsControl.xaml +++ b/gui/Controls/TagsControl.xaml @@ -3,11 +3,15 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:Data="clr-namespace:Profiler.Data" + xmlns:Data="clr-namespace:Profiler.Data" + xmlns:Profiler="clr-namespace:Profiler" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> + + + - +