Jumar Macato
7 years ago
No known key found for this signature in database
GPG Key ID: B19884DAC3A5BF3F
2 changed files with
27 additions and
11 deletions
-
samples/ControlCatalog/MainWindow.xaml
-
samples/ControlCatalog/MainWindow.xaml.cs
|
|
|
@ -37,12 +37,20 @@ |
|
|
|
</NativeMenu> |
|
|
|
</NativeMenu.Menu> |
|
|
|
|
|
|
|
<Window.DataTemplates> |
|
|
|
<DataTemplate DataType="vm:NotificationViewModel"> |
|
|
|
<v:CustomNotificationView /> |
|
|
|
</DataTemplate> |
|
|
|
</Window.DataTemplates> |
|
|
|
<Panel> |
|
|
|
<local:MainView/> |
|
|
|
</Panel> |
|
|
|
<Window.DataTemplates> |
|
|
|
<DataTemplate DataType="vm:NotificationViewModel"> |
|
|
|
<v:CustomNotificationView /> |
|
|
|
</DataTemplate> |
|
|
|
</Window.DataTemplates> |
|
|
|
<DockPanel LastChildFill="True"> |
|
|
|
<Menu Name="MainMenu" DockPanel.Dock="Top"> |
|
|
|
<MenuItem Header="File"> |
|
|
|
<MenuItem Header="Exit" /> |
|
|
|
</MenuItem> |
|
|
|
<MenuItem Header="Help"> |
|
|
|
<MenuItem Header="About" /> |
|
|
|
</MenuItem> |
|
|
|
</Menu> |
|
|
|
<local:MainView /> |
|
|
|
</DockPanel> |
|
|
|
</Window> |
|
|
|
|
|
|
|
@ -31,20 +31,28 @@ namespace ControlCatalog |
|
|
|
|
|
|
|
DataContext = new MainWindowViewModel(_notificationArea); |
|
|
|
_recentMenu = ((NativeMenu.GetMenu(this).Items[0] as NativeMenuItem).Menu.Items[2] as NativeMenuItem).Menu; |
|
|
|
var mainMenu = this.FindControl<Menu>("MainMenu"); |
|
|
|
mainMenu.AttachedToVisualTree += MenuAttached; |
|
|
|
} |
|
|
|
|
|
|
|
public void MenuAttached(object sender, VisualTreeAttachmentEventArgs e) |
|
|
|
{ |
|
|
|
if (NativeMenu.GetIsNativeMenuExported(this) && sender is Menu mainMenu) |
|
|
|
{ |
|
|
|
mainMenu.IsVisible = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public void OnOpenClicked(object sender, EventArgs args) |
|
|
|
{ |
|
|
|
_recentMenu.Items.Insert(0, new NativeMenuItem("Item " + (_recentMenu.Items.Count + 1))); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void OnCloseClicked(object sender, EventArgs args) |
|
|
|
{ |
|
|
|
Close(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void InitializeComponent() |
|
|
|
{ |
|
|
|
// TODO: iOS does not support dynamically loading assemblies
|
|
|
|
|