├── App.config
├── App.xaml
├── App.xaml.cs
├── Assets
└── IconDictionary.xaml
├── CustomControl
├── MenuWithSubMenuControl.xaml
└── MenuWithSubMenuControl.xaml.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── MenuWithSubMenu.csproj
├── MenuWithSubMenu.sln
├── Pages
├── AllUsers.xaml
├── AllUsers.xaml.cs
├── Dashboard.xaml
├── Dashboard.xaml.cs
├── Inbox.xaml
├── Inbox.xaml.cs
├── Mails.xaml
├── Mails.xaml.cs
├── NewUser.xaml
├── NewUser.xaml.cs
├── Outbox.xaml
├── Outbox.xaml.cs
├── Profile.xaml
├── Profile.xaml.cs
├── Sent.xaml
├── Sent.xaml.cs
├── Settings.xaml
└── Settings.xaml.cs
├── Properties
├── AssemblyInfo.cs
├── Resources.Designer.cs
├── Resources.resx
├── Settings.Designer.cs
└── Settings.settings
└── ViewModel
├── CommandViewModel.cs
└── SideMenuViewModel.cs
/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace MenuWithSubMenu
10 | {
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Assets/IconDictionary.xaml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/CustomControl/MenuWithSubMenuControl.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
36 |
37 |
68 |
69 |
70 |
71 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
114 |
147 |
148 |
149 |
152 |
153 |
154 |
155 |
156 |
161 |
166 |
167 |
168 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
--------------------------------------------------------------------------------
/CustomControl/MenuWithSubMenuControl.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace MenuWithSubMenu.CustomControl
17 | {
18 | ///
19 | /// Interaction logic for MenuWithSubMenuControl.xaml
20 | ///
21 | public partial class MenuWithSubMenuControl : UserControl
22 | {
23 | public MenuWithSubMenuControl()
24 | {
25 | InitializeComponent();
26 |
27 | //Binding our ViewModel with the datacontext to read the Menu & SubMenuItemsData
28 | DataContext = new SideMenuViewModel();
29 | }
30 |
31 |
32 | public Thickness SubMenuPadding
33 | {
34 | get { return (Thickness)GetValue(SubMenuPaddingProperty); }
35 | set { SetValue(SubMenuPaddingProperty, value); }
36 | }
37 |
38 | // Using a DependencyProperty as the backing store for SubMenuPadding. This enables animation, styling, binding, etc...
39 | public static readonly DependencyProperty SubMenuPaddingProperty =
40 | DependencyProperty.Register("SubMenuPadding", typeof(Thickness), typeof(MenuWithSubMenuControl));
41 |
42 |
43 |
44 | public bool HasIcon
45 | {
46 | get { return (bool)GetValue(HasIconProperty); }
47 | set { SetValue(HasIconProperty, value); }
48 | }
49 |
50 | // Using a DependencyProperty as the backing store for HasIcon. This enables animation, styling, binding, etc...
51 | public static readonly DependencyProperty HasIconProperty =
52 | DependencyProperty.Register("HasIcon", typeof(bool), typeof(MenuWithSubMenuControl));
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace MenuWithSubMenu
17 | {
18 | ///
19 | /// Interaction logic for MainWindow.xaml
20 | ///
21 | public partial class MainWindow : Window
22 | {
23 | public MainWindow()
24 | {
25 | InitializeComponent();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/MenuWithSubMenu.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {AAC56AAE-0E13-4DA6-9BE4-60D62E453B69}
8 | WinExe
9 | MenuWithSubMenu
10 | MenuWithSubMenu
11 | v4.6
12 | 512
13 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
14 | 4
15 | true
16 | true
17 |
18 |
19 | AnyCPU
20 | true
21 | full
22 | false
23 | bin\Debug\
24 | DEBUG;TRACE
25 | prompt
26 | 4
27 |
28 |
29 | AnyCPU
30 | pdbonly
31 | true
32 | bin\Release\
33 | TRACE
34 | prompt
35 | 4
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | 4.0
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 | MSBuild:Compile
56 | Designer
57 |
58 |
59 |
60 |
61 | MSBuild:Compile
62 | Designer
63 |
64 |
65 | Designer
66 | MSBuild:Compile
67 |
68 |
69 | MSBuild:Compile
70 | Designer
71 |
72 |
73 | App.xaml
74 | Code
75 |
76 |
77 | MenuWithSubMenuControl.xaml
78 |
79 |
80 | MainWindow.xaml
81 | Code
82 |
83 |
84 | MSBuild:Compile
85 | Designer
86 |
87 |
88 | MSBuild:Compile
89 | Designer
90 |
91 |
92 | MSBuild:Compile
93 | Designer
94 |
95 |
96 | MSBuild:Compile
97 | Designer
98 |
99 |
100 | MSBuild:Compile
101 | Designer
102 |
103 |
104 | MSBuild:Compile
105 | Designer
106 |
107 |
108 | MSBuild:Compile
109 | Designer
110 |
111 |
112 | MSBuild:Compile
113 | Designer
114 |
115 |
116 | MSBuild:Compile
117 | Designer
118 |
119 |
120 |
121 |
122 | AllUsers.xaml
123 |
124 |
125 | Dashboard.xaml
126 |
127 |
128 | Inbox.xaml
129 |
130 |
131 | Mails.xaml
132 |
133 |
134 | NewUser.xaml
135 |
136 |
137 | Outbox.xaml
138 |
139 |
140 | Profile.xaml
141 |
142 |
143 | Sent.xaml
144 |
145 |
146 | Settings.xaml
147 |
148 |
149 | Code
150 |
151 |
152 | True
153 | True
154 | Resources.resx
155 |
156 |
157 | True
158 | Settings.settings
159 | True
160 |
161 |
162 | ResXFileCodeGenerator
163 | Resources.Designer.cs
164 |
165 |
166 | SettingsSingleFileGenerator
167 | Settings.Designer.cs
168 |
169 |
170 |
171 |
172 |
173 |
174 |
--------------------------------------------------------------------------------
/MenuWithSubMenu.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.30406.217
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MenuWithSubMenu", "MenuWithSubMenu.csproj", "{AAC56AAE-0E13-4DA6-9BE4-60D62E453B69}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {AAC56AAE-0E13-4DA6-9BE4-60D62E453B69}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {AAC56AAE-0E13-4DA6-9BE4-60D62E453B69}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {AAC56AAE-0E13-4DA6-9BE4-60D62E453B69}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {AAC56AAE-0E13-4DA6-9BE4-60D62E453B69}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {800FC123-5C37-4B55-8196-EFC70C6F73F8}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/Pages/AllUsers.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Pages/AllUsers.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace MenuWithSubMenu.Pages
17 | {
18 | ///
19 | /// Interaction logic for AllUsers.xaml
20 | ///
21 | public partial class AllUsers : Page
22 | {
23 | public AllUsers()
24 | {
25 | InitializeComponent();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Pages/Dashboard.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Pages/Dashboard.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls;
2 |
3 | namespace MenuWithSubMenu.Pages
4 | {
5 | ///
6 | /// Interaction logic for Dashboard.xaml
7 | ///
8 | public partial class Dashboard : Page
9 | {
10 | public Dashboard()
11 | {
12 | InitializeComponent();
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Pages/Inbox.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Pages/Inbox.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace MenuWithSubMenu.Pages
17 | {
18 | ///
19 | /// Interaction logic for Inbox.xaml
20 | ///
21 | public partial class Inbox : Page
22 | {
23 | public Inbox()
24 | {
25 | InitializeComponent();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Pages/Mails.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Pages/Mails.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace MenuWithSubMenu.Pages
17 | {
18 | ///
19 | /// Interaction logic for Mails.xaml
20 | ///
21 | public partial class Mails : Page
22 | {
23 | public Mails()
24 | {
25 | InitializeComponent();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Pages/NewUser.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Pages/NewUser.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace MenuWithSubMenu.Pages
17 | {
18 | ///
19 | /// Interaction logic for NewUser.xaml
20 | ///
21 | public partial class NewUser : Page
22 | {
23 | public NewUser()
24 | {
25 | InitializeComponent();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Pages/Outbox.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Pages/Outbox.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace MenuWithSubMenu.Pages
17 | {
18 | ///
19 | /// Interaction logic for Outbox.xaml
20 | ///
21 | public partial class Outbox : Page
22 | {
23 | public Outbox()
24 | {
25 | InitializeComponent();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Pages/Profile.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Pages/Profile.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace MenuWithSubMenu.Pages
17 | {
18 | ///
19 | /// Interaction logic for Profile.xaml
20 | ///
21 | public partial class Profile : Page
22 | {
23 | public Profile()
24 | {
25 | InitializeComponent();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Pages/Sent.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Pages/Sent.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace MenuWithSubMenu.Pages
17 | {
18 | ///
19 | /// Interaction logic for Sent.xaml
20 | ///
21 | public partial class Sent : Page
22 | {
23 | public Sent()
24 | {
25 | InitializeComponent();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Pages/Settings.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Pages/Settings.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace MenuWithSubMenu.Pages
17 | {
18 | ///
19 | /// Interaction logic for Settings.xaml
20 | ///
21 | public partial class Settings : Page
22 | {
23 | public Settings()
24 | {
25 | InitializeComponent();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("MenuWithSubMenu")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("MenuWithSubMenu")]
15 | [assembly: AssemblyCopyright("Copyright © 2020")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace MenuWithSubMenu.Properties
12 | {
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Returns the cached ResourceManager instance used by this class.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MenuWithSubMenu.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Overrides the current thread's CurrentUICulture property for all
56 | /// resource lookups using this strongly typed resource class.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace MenuWithSubMenu.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/ViewModel/CommandViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Input;
3 |
4 | namespace MenuWithSubMenu
5 | {
6 | public class CommandViewModel : ICommand
7 | {
8 | private readonly Action _action;
9 |
10 | public CommandViewModel(Action action)
11 | {
12 | _action = action;
13 | }
14 |
15 | public void Execute(object o)
16 | {
17 | _action();
18 | }
19 |
20 | public bool CanExecute(object o)
21 | {
22 | return true;
23 | }
24 |
25 | public event EventHandler CanExecuteChanged
26 | {
27 | add { }
28 | remove { }
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/ViewModel/SideMenuViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Input;
8 | using System.Windows.Media;
9 |
10 | namespace MenuWithSubMenu
11 | {
12 | class SideMenuViewModel
13 | {
14 | //to call resource dictionary in our code behind
15 | ResourceDictionary dict = Application.LoadComponent(new Uri("/MenuWithSubMenu;component/Assets/IconDictionary.xaml", UriKind.RelativeOrAbsolute)) as ResourceDictionary;
16 |
17 |
18 | //Our Source List for Menu Items
19 | public List MenuList
20 | {
21 | get
22 | {
23 | return new List
24 | {
25 | //MainMenu without SubMenu Button
26 | new MenuItemsData(){ PathData= (PathGeometry)dict["icon_dashboard"], MenuText="Dashboard", SubMenuList=null},
27 |
28 | //MainMenu Button
29 | new MenuItemsData(){ PathData= (PathGeometry)dict["icon_users"], MenuText="Profile"
30 |
31 | //SubMenu Button
32 | , SubMenuList=new List{
33 | new SubMenuItemsData(){ PathData=(PathGeometry)dict["icon_adduser"], SubMenuText="New User" },
34 | new SubMenuItemsData(){ PathData=(PathGeometry)dict["icon_alluser"], SubMenuText="All Users" }}
35 | },
36 |
37 | //MainMenu Button
38 | new MenuItemsData(){ PathData= (PathGeometry)dict["icon_mails"], MenuText="Mails"
39 |
40 | //SubMenu Button
41 | , SubMenuList=new List{
42 | new SubMenuItemsData(){ PathData=(PathGeometry)dict["icon_inbox"], SubMenuText="Inbox" },
43 | new SubMenuItemsData(){ PathData=(PathGeometry)dict["icon_outbox"], SubMenuText="Outbox" },
44 | new SubMenuItemsData(){ PathData=(PathGeometry)dict["icon_sentmail"], SubMenuText="Sent" }}},
45 |
46 | //MainMenu without SubMenu Button
47 | new MenuItemsData(){ PathData= (PathGeometry)dict["icon_settings"], MenuText="Settings", SubMenuList=null}
48 | };
49 | }
50 | }
51 | }
52 |
53 | public class MenuItemsData
54 | {
55 | //Icon Data
56 | public PathGeometry PathData { get; set; }
57 | public string MenuText { get; set; }
58 | public List SubMenuList { get; set; }
59 |
60 | //To Add click event to our Buttons we will use ICommand here to switch pages when specific button is clicked
61 | public MenuItemsData()
62 | {
63 | Command = new CommandViewModel(Execute);
64 | }
65 |
66 | public ICommand Command { get; }
67 |
68 | private void Execute()
69 | {
70 | //our logic comes here
71 | string MT = MenuText.Replace(" ", string.Empty);
72 | if (!string.IsNullOrEmpty(MT))
73 | navigateToPage(MT);
74 | }
75 |
76 | private void navigateToPage(string Menu)
77 | {
78 | //We will search for our Main Window in open windows and then will access the frame inside it to set the navigation to desired page..
79 | //lets see how... ;)
80 | foreach (Window window in Application.Current.Windows)
81 | {
82 | if (window.GetType() == typeof(MainWindow))
83 | {
84 | (window as MainWindow).MainWindowFrame.Navigate(new Uri(string.Format("{0}{1}{2}", "Pages/", Menu, ".xaml"), UriKind.RelativeOrAbsolute));
85 | }
86 | }
87 | }
88 | }
89 | public class SubMenuItemsData
90 | {
91 | public PathGeometry PathData { get; set; }
92 | public string SubMenuText { get; set; }
93 |
94 | //To Add click event to our Buttons we will use ICommand here to switch pages when specific button is clicked
95 | public SubMenuItemsData()
96 | {
97 | SubMenuCommand = new CommandViewModel(Execute);
98 | }
99 |
100 | public ICommand SubMenuCommand { get; }
101 |
102 | private void Execute()
103 | {
104 | //our logic comes here
105 | string SMT = SubMenuText.Replace(" ", string.Empty);
106 | if (!string.IsNullOrEmpty(SMT))
107 | navigateToPage(SMT);
108 | }
109 |
110 | private void navigateToPage(string Menu)
111 | {
112 | //We will search for our Main Window in open windows and then will access the frame inside it to set the navigation to desired page..
113 | //lets see how... ;)
114 | foreach (Window window in Application.Current.Windows)
115 | {
116 | if (window.GetType() == typeof(MainWindow))
117 | {
118 | (window as MainWindow).MainWindowFrame.Navigate(new Uri(string.Format("{0}{1}{2}", "Pages/", Menu, ".xaml"), UriKind.RelativeOrAbsolute));
119 | }
120 | }
121 | }
122 | }
123 | }
--------------------------------------------------------------------------------