EmbedToWpfDemo.xaml.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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.Controls;
  7. using System.Windows.Data;
  8. using System.Windows.Documents;
  9. using System.Windows.Input;
  10. using System.Windows.Media;
  11. using System.Windows.Media.Imaging;
  12. using System.Windows.Navigation;
  13. using System.Windows.Shapes;
  14. using Avalonia;
  15. using Avalonia.Controls;
  16. using Avalonia.VisualTree;
  17. using ControlCatalog;
  18. using Window = System.Windows.Window;
  19. namespace WindowsInteropTest
  20. {
  21. /// <summary>
  22. /// Interaction logic for EmbedToWpfDemo.xaml
  23. /// </summary>
  24. public partial class EmbedToWpfDemo : Window
  25. {
  26. public EmbedToWpfDemo()
  27. {
  28. InitializeComponent();
  29. var view = new MainView();
  30. view.AttachedToVisualTree += delegate
  31. {
  32. ((TopLevel) view.GetVisualRoot()).AttachDevTools();
  33. };
  34. Host.Content = view;
  35. var btn = (Avalonia.Controls.Button) RightBtn.Content;
  36. btn.Click += delegate
  37. {
  38. btn.Content += "!";
  39. };
  40. }
  41. }
  42. }