-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1086 from IbraheemOsama/ClassicMenu
Classic menu
- Loading branch information
Showing
18 changed files
with
1,518 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Menu/Commands/VsCommands.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
136 changes: 136 additions & 0 deletions
136
Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Menu/Menu.bind
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
<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> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="auto" /> | ||
<RowDefinition Height="auto" /> | ||
</Grid.RowDefinitions> | ||
|
||
<controls:Menu AllowTooltip="@[AllowTooltip:Bool:True]" | ||
Orientation="@[Orientation:Enum:Orientation.Horizontal]" | ||
TooltipPlacement="@[TooltipPlacement:Enum:PlacementMode.Bottom]"> | ||
|
||
<controls:MenuItem 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+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> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
139 changes: 139 additions & 0 deletions
139
Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Menu/MenuPage.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
<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}" | ||
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> |
Oops, something went wrong.