Program.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright (c) The Perspex Project. All rights reserved.
  2. // Licensed under the MIT license. See licence.md file in the project root for full license information.
  3. using System;
  4. using System.Diagnostics;
  5. using System.Windows.Threading;
  6. using Perspex;
  7. using Perspex.Collections;
  8. using Perspex.Controls;
  9. using Perspex.Controls.Templates;
  10. using ReactiveUI;
  11. using XamlTestApplication.Views;
  12. namespace XamlTestApplication
  13. {
  14. internal class Item
  15. {
  16. public string Name { get; set; }
  17. public string Value { get; set; }
  18. }
  19. internal class Node
  20. {
  21. public Node()
  22. {
  23. Children = new PerspexList<Node>();
  24. }
  25. public string Name { get; set; }
  26. public PerspexList<Node> Children { get; set; }
  27. }
  28. internal class Program
  29. {
  30. private static void Main()
  31. {
  32. var foo = Dispatcher.CurrentDispatcher;
  33. App application = new App
  34. {
  35. DataTemplates = new DataTemplates
  36. {
  37. new TreeDataTemplate<Node>(
  38. x => new TextBlock { Text = x.Name },
  39. x => x.Children,
  40. x => true),
  41. },
  42. };
  43. var testCommand = ReactiveCommand.Create();
  44. testCommand.Subscribe(_ => Debug.WriteLine("Test command executed."));
  45. var window = new MainWindow();
  46. window.Show();
  47. Application.Current.Run(window);
  48. }
  49. }
  50. }