Program.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #if PERSPEX_GTK
  2. using Perspex.Gtk;
  3. #endif
  4. namespace XamlTestApplication
  5. {
  6. using System;
  7. using System.Diagnostics;
  8. using System.Windows.Threading;
  9. using Glass;
  10. using OmniXaml.AppServices.Mvvm;
  11. using OmniXaml.AppServices.NetCore;
  12. using Perspex;
  13. using Perspex.Collections;
  14. using Perspex.Controls;
  15. using Perspex.Controls.Templates;
  16. using Perspex.Input;
  17. using Perspex.Xaml.Desktop;
  18. using ReactiveUI;
  19. using Views;
  20. class Item
  21. {
  22. public string Name { get; set; }
  23. public string Value { get; set; }
  24. }
  25. class Node
  26. {
  27. public Node()
  28. {
  29. this.Children = new PerspexList<Node>();
  30. }
  31. public string Name { get; set; }
  32. public PerspexList<Node> Children { get; set; }
  33. }
  34. class Program
  35. {
  36. static void Main()
  37. {
  38. var foo = Dispatcher.CurrentDispatcher;
  39. App application = new App
  40. {
  41. DataTemplates = new DataTemplates
  42. {
  43. new TreeDataTemplate<Node>(
  44. x => new TextBlock { Text = x.Name },
  45. x => x.Children,
  46. x => true),
  47. },
  48. };
  49. var testCommand = ReactiveCommand.Create();
  50. testCommand.Subscribe(_ => Debug.WriteLine("Test command executed."));
  51. var window = new MainWindow();
  52. window.Show();
  53. Application.Current.Run(window);
  54. }
  55. }
  56. }