-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Classic menu #1086
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Classic menu #1086
Changes from 58 commits
856ccb9
2388c94
b1d7520
b8fd598
0f0dd32
61acc21
aea3bb5
43e96a1
1d43869
091faaf
ecd0544
201644f
11e95c0
39a7b2b
0e6637d
d6be89d
4cc9d0e
3693abf
dcfef83
a20c4de
8055fa1
3bef24d
e5fad33
e4ba89e
d246391
008a4ba
b9f1294
dc12a3f
fc4adcd
a2b3bc4
0a0624e
1fe90f1
14c432b
a78f90e
caedbe7
99bffdc
a5f01a6
4253f83
fc93320
203098c
ab129cf
bfe9695
91c6c32
3587d7c
c0dc082
23283b7
ec9afa4
c854baf
1c39eab
50faf2f
ae51858
33f8bfb
86d261e
015747a
184731f
da18bf4
b529aa9
eafdcde
fa79558
f2877f0
41ea514
6fde02e
d931857
03c7502
50ba981
4a143ae
57a3d67
ab21155
9324573
5e19294
9fee708
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| // ****************************************************************** | ||
| // Copyright (c) Microsoft. All rights reserved. | ||
| // This code is licensed under the MIT License (MIT). | ||
| // THE CODE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | ||
| // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
| // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | ||
| // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | ||
| // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH | ||
| // THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE. | ||
| // ****************************************************************** | ||
|
|
||
| using System; | ||
| using System.Windows.Input; | ||
| using Windows.UI.Popups; | ||
|
|
||
| namespace Microsoft.Toolkit.Uwp.SampleApp.Menu.Commands | ||
| { | ||
| internal class NewProjectCommand : ICommand | ||
| { | ||
| public bool CanExecute(object parameter) | ||
| { | ||
| return true; | ||
| } | ||
|
|
||
| public async void Execute(object parameter) | ||
| { | ||
| var dialog = new MessageDialog("Create New Project"); | ||
| await dialog.ShowAsync(); | ||
| } | ||
|
|
||
| public event EventHandler CanExecuteChanged; | ||
| } | ||
|
|
||
| internal class NewFileCommand : ICommand | ||
| { | ||
| public bool CanExecute(object parameter) | ||
| { | ||
| return true; | ||
| } | ||
|
|
||
| public async void Execute(object parameter) | ||
| { | ||
| var dialog = new MessageDialog("Create New File"); | ||
| await dialog.ShowAsync(); | ||
| } | ||
|
|
||
| public event EventHandler CanExecuteChanged; | ||
| } | ||
|
|
||
| internal class GenericCommand : ICommand | ||
| { | ||
| public bool CanExecute(object parameter) | ||
| { | ||
| return true; | ||
| } | ||
|
|
||
| public async void Execute(object parameter) | ||
| { | ||
| var dialog = new MessageDialog(parameter.ToString()); | ||
| await dialog.ShowAsync(); | ||
| } | ||
|
|
||
| public event EventHandler CanExecuteChanged; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,141 @@ | ||
| <Page x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.MenuPage" | ||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
| xmlns:commands="using:Microsoft.Toolkit.Uwp.SampleApp.Menu.Commands" | ||
| xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls" | ||
| xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
| xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
| mc:Ignorable="d"> | ||
|
|
||
| <Page.Resources> | ||
| <ResourceDictionary> | ||
| <ResourceDictionary.MergedDictionaries> | ||
| <ResourceDictionary Source="MenuStyles.xaml" /> | ||
| </ResourceDictionary.MergedDictionaries> | ||
|
|
||
| <commands:NewProjectCommand x:Key="NewProject" /> | ||
| <commands:NewFileCommand x:Key="NewFile" /> | ||
| <commands:GenericCommand x:Key="GenericCommand" /> | ||
| </ResourceDictionary> | ||
|
|
||
|
|
||
| </Page.Resources> | ||
|
|
||
| <Grid Background="{StaticResource Brush-Grey-05}"> | ||
|
||
| <Grid.RowDefinitions> | ||
| <RowDefinition Height="auto" /> | ||
| <RowDefinition Height="auto" /> | ||
| </Grid.RowDefinitions> | ||
|
|
||
| <controls:Menu RequestedTheme="Light" | ||
|
||
| AllowTooltip="@[AllowTooltip:Bool:True]" | ||
| Orientation="@[Orientation:Enum:Orientation.Horizontal]" | ||
| TooltipPlacement="@[TooltipPlacement:Enum:PlacementMode.Bottom]"> | ||
|
|
||
| <controls:MenuItem controls:Menu.InputGestureText="Alt+F" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All of the MenuItems should have keyboard shortcuts.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: Only talking about the main MenuItems, not the subitems |
||
| Header="File"> | ||
| <MenuFlyoutSubItem Text="New"> | ||
| <MenuFlyoutItem controls:Menu.InputGestureText="Ctrl+Shift+N" | ||
| Command="{StaticResource NewProject}" | ||
| Text="Project" /> | ||
| <MenuFlyoutItem controls:Menu.InputGestureText="Ctrl+N" | ||
| Command="{StaticResource NewFile}" | ||
| Text="File" /> | ||
| </MenuFlyoutSubItem> | ||
| <MenuFlyoutSubItem Text="Open"> | ||
| <MenuFlyoutItem controls:Menu.InputGestureText="Ctrl+Shift+O" | ||
| Command="{StaticResource GenericCommand}" | ||
| CommandParameter="Select Project/Solution" | ||
| Text="Project/Solution" /> | ||
| <MenuFlyoutItem controls:Menu.InputGestureText="Ctrl+O" | ||
| Command="{StaticResource GenericCommand}" | ||
| CommandParameter="Select File" | ||
| Text="File" /> | ||
| </MenuFlyoutSubItem> | ||
| <MenuFlyoutSeparator /> | ||
| <MenuFlyoutItem Text="Page Setup" /> | ||
| <MenuFlyoutItem controls:Menu.InputGestureText="Ctrl+P" | ||
| Command="{StaticResource GenericCommand}" | ||
| CommandParameter="Page is Printed!!" | ||
| Text="Print" /> | ||
| <MenuFlyoutSeparator /> | ||
| <MenuFlyoutSubItem Text="Recent Files"> | ||
| <MenuFlyoutItem Text="UWP ToolKit GridSplitter" /> | ||
| <MenuFlyoutItem Text="UWP ToolKit WrapPanel" /> | ||
| </MenuFlyoutSubItem> | ||
| <MenuFlyoutItem controls:Menu.InputGestureText="Ctrl+Shit+E" | ||
| Command="{StaticResource GenericCommand}" | ||
| CommandParameter="Solution closed" | ||
| Text="Exit" /> | ||
| </controls:MenuItem> | ||
|
|
||
|
|
||
| <controls:MenuItem Header="Edit"> | ||
| <MenuFlyoutSubItem Text="Go To"> | ||
| <MenuFlyoutItem Text="Go To Line" /> | ||
| <MenuFlyoutItem Text="Go To All" /> | ||
| </MenuFlyoutSubItem> | ||
|
|
||
| <MenuFlyoutSubItem Text="Find and Replace"> | ||
| <MenuFlyoutItem Text="Find" /> | ||
| <MenuFlyoutItem Text="Replace" /> | ||
| </MenuFlyoutSubItem> | ||
| </controls:MenuItem> | ||
|
|
||
| <controls:MenuItem Header="View"> | ||
| <MenuFlyoutSubItem Text="Designer"> | ||
| <MenuFlyoutItem Text="VS Designer" /> | ||
| <MenuFlyoutItem Text="Blend" /> | ||
| </MenuFlyoutSubItem> | ||
|
|
||
| <MenuFlyoutSubItem Text="Solution Explorer"> | ||
| <MenuFlyoutItem Text="Solutions" /> | ||
| <MenuFlyoutItem Text="Projects" /> | ||
| </MenuFlyoutSubItem> | ||
| </controls:MenuItem> | ||
|
|
||
| <controls:MenuItem Header="Project"> | ||
| <MenuFlyoutSubItem Text="Add Class"> | ||
| <MenuFlyoutItem Text="Class" /> | ||
| <MenuFlyoutItem Text="Interface" /> | ||
| </MenuFlyoutSubItem> | ||
|
|
||
| <MenuFlyoutSubItem Text="Add new data source"> | ||
| <MenuFlyoutItem Text="SQL" /> | ||
| <MenuFlyoutItem Text="NoSQL" /> | ||
| </MenuFlyoutSubItem> | ||
| </controls:MenuItem> | ||
|
|
||
| <controls:MenuItem Header="Build"> | ||
| <MenuFlyoutItem Text="Build Solution" /> | ||
| <MenuFlyoutItem Text="Rebuild Solution" /> | ||
| </controls:MenuItem> | ||
|
|
||
| <controls:MenuItem Header="Debug"> | ||
| <MenuFlyoutSubItem Text="Windows"> | ||
| <MenuFlyoutItem Text="Windows 8" /> | ||
| <MenuFlyoutItem Text="Windows 10" /> | ||
| </MenuFlyoutSubItem> | ||
|
|
||
| <MenuFlyoutSubItem Text="Graphics"> | ||
| <MenuFlyoutItem Text="Canvas" /> | ||
| <MenuFlyoutItem Text="Grid" /> | ||
| </MenuFlyoutSubItem> | ||
| </controls:MenuItem> | ||
|
|
||
| </controls:Menu> | ||
|
|
||
| <StackPanel Grid.Row="1"> | ||
| <TextBlock Text="Click Alt to set focus on Classic Menu" /> | ||
| <TextBlock Text="To open file menu shortcut: Alt+F" /> | ||
| <TextBlock Text="Create new project shortcut: Ctrl+Shift+N" /> | ||
| <TextBlock Text="Create new file shortcut: Ctrl+N" /> | ||
| <TextBlock Text="Open project shortcut: Ctrl+Shift+O" /> | ||
| <TextBlock Text="Open file shortcut: Ctrl+O" /> | ||
| <TextBlock Text="Print shortcut: Ctrl+P" /> | ||
| <TextBlock Text="Exit solution shortcut: Ctrl+Shit+E" /> | ||
| </StackPanel> | ||
|
|
||
|
|
||
| </Grid> | ||
| </Page> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,140 @@ | ||
| <Page x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.MenuPage" | ||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
| xmlns:commands="using:Microsoft.Toolkit.Uwp.SampleApp.Menu.Commands" | ||
| xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls" | ||
| xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
| xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
| mc:Ignorable="d"> | ||
|
|
||
| <Page.Resources> | ||
| <ResourceDictionary> | ||
| <commands:NewProjectCommand x:Key="NewProject" /> | ||
| <commands:NewFileCommand x:Key="NewFile" /> | ||
| <commands:GenericCommand x:Key="GenericCommand" /> | ||
| </ResourceDictionary> | ||
| </Page.Resources> | ||
|
|
||
| <Grid Background="{StaticResource Brush-Grey-05}"> | ||
| <Grid.RowDefinitions> | ||
| <RowDefinition Height="auto" /> | ||
| <RowDefinition Height="auto" /> | ||
| </Grid.RowDefinitions> | ||
|
|
||
| <controls:Menu AllowTooltip="{Binding AllowTooltip.Value, Mode=TwoWay}" | ||
| Orientation="{Binding Orientation.Value, Mode=TwoWay}" | ||
| RequestedTheme="Light" | ||
| TooltipPlacement="{Binding TooltipPlacement.Value, Mode=TwoWay}"> | ||
|
|
||
| <controls:MenuItem Name="FileMenu" | ||
| controls:Menu.InputGestureText="Alt+F" | ||
| Header="File"> | ||
| <MenuFlyoutSubItem Text="New"> | ||
| <MenuFlyoutItem controls:Menu.InputGestureText="Ctrl+Shift+N" | ||
| Command="{StaticResource NewProject}" | ||
| Text="Project" /> | ||
| <MenuFlyoutItem controls:Menu.InputGestureText="Ctrl+N" | ||
| Command="{StaticResource NewFile}" | ||
| Text="File" /> | ||
| </MenuFlyoutSubItem> | ||
| <MenuFlyoutSubItem Text="Open"> | ||
| <MenuFlyoutItem controls:Menu.InputGestureText="Ctrl+Shift+O" | ||
| Command="{StaticResource GenericCommand}" | ||
| CommandParameter="Select Project/Solution" | ||
| Text="Project/Solution" /> | ||
| <MenuFlyoutItem controls:Menu.InputGestureText="Ctrl+O" | ||
| Command="{StaticResource GenericCommand}" | ||
| CommandParameter="Select File" | ||
| Text="File" /> | ||
| </MenuFlyoutSubItem> | ||
| <MenuFlyoutSeparator /> | ||
| <MenuFlyoutItem Text="Page Setup" /> | ||
| <MenuFlyoutItem controls:Menu.InputGestureText="Ctrl+P" | ||
| Command="{StaticResource GenericCommand}" | ||
| CommandParameter="Page is Printed!!" | ||
| Text="Print" /> | ||
| <MenuFlyoutSeparator /> | ||
| <MenuFlyoutSubItem Text="Recent Files"> | ||
| <MenuFlyoutItem Text="UWP ToolKit GridSplitter" /> | ||
| <MenuFlyoutItem Text="UWP ToolKit WrapPanel" /> | ||
| </MenuFlyoutSubItem> | ||
| <MenuFlyoutItem controls:Menu.InputGestureText="Ctrl+Shift+E" | ||
| Command="{StaticResource GenericCommand}" | ||
| CommandParameter="Solution closed" | ||
| Text="Exit" /> | ||
| </controls:MenuItem> | ||
|
|
||
|
|
||
| <controls:MenuItem controls:Menu.InputGestureText="Alt+E" | ||
| Header="Edit"> | ||
| <MenuFlyoutSubItem Text="Go To"> | ||
| <MenuFlyoutItem Text="Go To Line" /> | ||
| <MenuFlyoutItem Text="Go To All" /> | ||
| </MenuFlyoutSubItem> | ||
|
|
||
| <MenuFlyoutSubItem Text="Find and Replace"> | ||
| <MenuFlyoutItem Text="Find" /> | ||
| <MenuFlyoutItem Text="Replace" /> | ||
| </MenuFlyoutSubItem> | ||
| </controls:MenuItem> | ||
|
|
||
| <controls:MenuItem controls:Menu.InputGestureText="Alt+V" | ||
| Header="View"> | ||
| <MenuFlyoutSubItem Text="Designer"> | ||
| <MenuFlyoutItem Text="VS Designer" /> | ||
| <MenuFlyoutItem Text="Blend" /> | ||
| </MenuFlyoutSubItem> | ||
|
|
||
| <MenuFlyoutSubItem Text="Solution Explorer"> | ||
| <MenuFlyoutItem Text="Solutions" /> | ||
| <MenuFlyoutItem Text="Projects" /> | ||
| </MenuFlyoutSubItem> | ||
| </controls:MenuItem> | ||
|
|
||
| <controls:MenuItem controls:Menu.InputGestureText="Alt+P" | ||
| Header="Project"> | ||
| <MenuFlyoutSubItem Text="Add Class"> | ||
| <MenuFlyoutItem Text="Class" /> | ||
| <MenuFlyoutItem Text="Interface" /> | ||
| </MenuFlyoutSubItem> | ||
|
|
||
| <MenuFlyoutSubItem Text="Add new data source"> | ||
| <MenuFlyoutItem Text="SQL" /> | ||
| <MenuFlyoutItem Text="NoSQL" /> | ||
| </MenuFlyoutSubItem> | ||
| </controls:MenuItem> | ||
|
|
||
| <controls:MenuItem controls:Menu.InputGestureText="Alt+B" | ||
| Header="Build"> | ||
| <MenuFlyoutItem Text="Build Solution" /> | ||
| <MenuFlyoutItem Text="Rebuild Solution" /> | ||
| </controls:MenuItem> | ||
|
|
||
| <controls:MenuItem controls:Menu.InputGestureText="Alt+D" | ||
| Header="Debug"> | ||
| <MenuFlyoutSubItem Text="Windows"> | ||
| <MenuFlyoutItem Text="Windows 8" /> | ||
| <MenuFlyoutItem Text="Windows 10" /> | ||
| </MenuFlyoutSubItem> | ||
|
|
||
| <MenuFlyoutSubItem Text="Graphics"> | ||
| <MenuFlyoutItem Text="Canvas" /> | ||
| <MenuFlyoutItem Text="Grid" /> | ||
| </MenuFlyoutSubItem> | ||
| </controls:MenuItem> | ||
|
|
||
| </controls:Menu> | ||
|
|
||
| <StackPanel Grid.Row="1"> | ||
| <TextBlock Text="Click Alt to set focus on Classic Menu" /> | ||
| <TextBlock Text="Any menu shortcut is Alt + (The first character of the menu name), ex to open File menu click Alt+F" /> | ||
| <TextBlock Text="Create new project shortcut: Ctrl+Shift+N" /> | ||
| <TextBlock Text="Create new file shortcut: Ctrl+N" /> | ||
| <TextBlock Text="Open project shortcut: Ctrl+Shift+O" /> | ||
| <TextBlock Text="Open file shortcut: Ctrl+O" /> | ||
| <TextBlock Text="Print shortcut: Ctrl+P" /> | ||
| <TextBlock Text="Exit solution shortcut: Ctrl+Shit+E" /> | ||
| </StackPanel> | ||
|
|
||
| </Grid> | ||
| </Page> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be safely removed