-
Notifications
You must be signed in to change notification settings - Fork 124
/
Copy pathTemplateImageConverter.cs
41 lines (38 loc) · 1.6 KB
/
TemplateImageConverter.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#region Copyright Syncfusion Inc. 2001-2020.
// Copyright Syncfusion Inc. 2001-2020. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using Syncfusion.UI.Xaml.TreeGrid.Cells;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media.Imaging;
namespace syncfusion.treegriddemos.wpf
{
public class TemplateImageConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value == null)
return null;
var dataContextHelper = value as TreeGridDataContextHelper;
var record = dataContextHelper.Record as FileInfoModel;
if (record.FileType == "DriveNode")
return new BitmapImage(new Uri(@"/syncfusion.treegriddemos.wpf;component/Assets/treegrid/DriveNode.png", UriKind.Relative));
else if (record.FileType == "Directory")
return new BitmapImage(new Uri(@"/syncfusion.treegriddemos.wpf;component/Assets/treegrid/Directory.png", UriKind.Relative));
return null;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return null;
}
}
}