diff --git a/samples/ControlCatalog/App.xaml b/samples/ControlCatalog/App.xaml
index 43971dec4f..95d515ec60 100644
--- a/samples/ControlCatalog/App.xaml
+++ b/samples/ControlCatalog/App.xaml
@@ -14,6 +14,11 @@
-
+
+
+
-
\ No newline at end of file
+
diff --git a/samples/ControlCatalog/Pages/MenuPage.xaml b/samples/ControlCatalog/Pages/MenuPage.xaml
index 296cfa8704..6eeb86a00f 100644
--- a/samples/ControlCatalog/Pages/MenuPage.xaml
+++ b/samples/ControlCatalog/Pages/MenuPage.xaml
@@ -7,29 +7,44 @@
Margin="0,16,0,0"
HorizontalAlignment="Center"
Spacing="16">
-
+
+
+
+ Dyanamically generated
+
+
+
+
+
+
-
\ No newline at end of file
+
diff --git a/samples/ControlCatalog/Pages/MenuPage.xaml.cs b/samples/ControlCatalog/Pages/MenuPage.xaml.cs
index d637c172e1..880d4bc59a 100644
--- a/samples/ControlCatalog/Pages/MenuPage.xaml.cs
+++ b/samples/ControlCatalog/Pages/MenuPage.xaml.cs
@@ -1,3 +1,4 @@
+using System.Collections.Generic;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
@@ -8,6 +9,27 @@ namespace ControlCatalog.Pages
public MenuPage()
{
this.InitializeComponent();
+ DataContext = new[]
+ {
+ new MenuItemViewModel
+ {
+ Header = "_File",
+ Items =
+ {
+ new MenuItemViewModel { Header = "_Open..." },
+ new MenuItemViewModel { Header = "Save" },
+ }
+ },
+ new MenuItemViewModel
+ {
+ Header = "_Edit",
+ Items =
+ {
+ new MenuItemViewModel { Header = "_Copy" },
+ new MenuItemViewModel { Header = "_Paste" },
+ }
+ }
+ };
}
private void InitializeComponent()
@@ -15,4 +37,10 @@ namespace ControlCatalog.Pages
AvaloniaXamlLoader.Load(this);
}
}
+
+ public class MenuItemViewModel
+ {
+ public string Header { get; set; }
+ public IList Items { get; } = new List();
+ }
}