diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-06-17 19:06:13 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-06-17 19:06:13 +0300 |
| commit | 7658a8546a9c33a76376dff3ab646f2aceaf0a01 (patch) | |
| tree | 10c2cee7f96268e9052e19901f49f3e0a1e75d41 /Software/Visual_Studio/PPC/Tango.PPC.UI/Converters | |
| parent | 22853e394b878578084db1062664c38c40e88d07 (diff) | |
| download | Tango-7658a8546a9c33a76376dff3ab646f2aceaf0a01.tar.gz Tango-7658a8546a9c33a76376dff3ab646f2aceaf0a01.zip | |
Working on PPC !!!
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/Converters')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/NotificationItemConverter.cs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/NotificationItemConverter.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/NotificationItemConverter.cs new file mode 100644 index 000000000..4e3291b97 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/NotificationItemConverter.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; +using Tango.PPC.Common.Notifications; + +namespace Tango.PPC.UI.Converters +{ + public class NotificationItemConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + NotificationItem item = value as NotificationItem; + + if (item != null) + { + var view = Activator.CreateInstance(item.ViewType) as FrameworkElement; + + if (view == null) + { + throw new InvalidOperationException("The type " + item.ViewType + " is not a framework element."); + } + + view.DataContext = item; + return view; + } + + return null; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} |
