FolderOrFileTemplateSelector.cs 772 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. namespace VirgoUI.Client.Models.Recipe
  9. {
  10. public class FolderOrFileTemplateSelector : DataTemplateSelector
  11. {
  12. public DataTemplate FolderTemplate
  13. {
  14. get;
  15. set;
  16. }
  17. public DataTemplate FileTemplate
  18. {
  19. get;
  20. set;
  21. }
  22. public override DataTemplate SelectTemplate(object item, DependencyObject container)
  23. {
  24. FileNode file = (FileNode)item;
  25. if (!file.IsFile)
  26. return FolderTemplate;
  27. else
  28. return FileTemplate;
  29. }
  30. }
  31. }