EmbedToWpfDemo.xaml.cs 648 B

1234567891011121314151617181920212223242526272829
  1. using System.Windows;
  2. using Avalonia;
  3. using Avalonia.Controls;
  4. using ControlCatalog;
  5. namespace WindowsInteropTest
  6. {
  7. public partial class EmbedToWpfDemo
  8. {
  9. public EmbedToWpfDemo()
  10. {
  11. InitializeComponent();
  12. Host.Content = new MainView();
  13. var btn = (Button) RightBtn.Content!;
  14. btn.Click += delegate
  15. {
  16. btn.Content += "!";
  17. };
  18. Loaded += OnLoaded;
  19. }
  20. private void OnLoaded(object sender, RoutedEventArgs e)
  21. {
  22. TopLevel.GetTopLevel((MainView)Host.Content)!.AttachDevTools();
  23. }
  24. }
  25. }