MainWindow.cs 800 B

123456789101112131415161718192021222324252627282930
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Avalonia.Diagnostics;
  7. using Avalonia.Gtk.Embedding;
  8. using ControlCatalog;
  9. using Gtk;
  10. namespace GtkInteropDemo
  11. {
  12. class MainWindow : Window
  13. {
  14. public MainWindow() : base("Gtk Embedding Demo")
  15. {
  16. var root = new HBox();
  17. var left = new VBox();
  18. left.Add(new Button("I'm GTK button"));
  19. left.Add(new Calendar());
  20. root.PackEnd(left, false, false, 0);
  21. var host = new GtkAvaloniaControlHost() {Content = new MainView()};
  22. host.SetSizeRequest(600, 600);
  23. root.PackStart(host, true, true, 0);
  24. Add(root);
  25. ShowAll();
  26. }
  27. }
  28. }