diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-03-18 15:01:48 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-03-18 15:01:48 +0200 |
| commit | c1ba3dfd40a942a28d50b90e511f9695f3e48c42 (patch) | |
| tree | 819c9a055a1321f7d9a607d6f79f2840b5b0fa96 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters | |
| parent | 73327143a2ac187695bed0ecded52c4d675165c4 (diff) | |
| parent | e6be03de10afc55c2ceac18dbd690e2ed127c8d8 (diff) | |
| download | Tango-c1ba3dfd40a942a28d50b90e511f9695f3e48c42.tar.gz Tango-c1ba3dfd40a942a28d50b90e511f9695f3e48c42.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/StringToEllipsisConverter.cs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/StringToEllipsisConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/StringToEllipsisConverter.cs new file mode 100644 index 000000000..2a14bce1e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/StringToEllipsisConverter.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Tango.MachineStudio.Developer.Converters +{ + public class StringToEllipsisConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + String text = value as String; + int length = 0; + + if (text != null && parameter != null && int.TryParse(parameter.ToString(), out length)) + { + return text.Ellipsis(length); + } + + return String.Empty; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} |
