Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
WaldemarCoding committed May 6, 2020
0 parents commit 6ed2386
Show file tree
Hide file tree
Showing 55 changed files with 1,952 additions and 0 deletions.
511 changes: 511 additions & 0 deletions .gitignore

Large diffs are not rendered by default.

Binary file added Flyouts.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions MahApps.Metro.Prism.Demo.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30011.22
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MahApps.Metro.PrismApp.Core", "MahApps.Metro.PrismApp.Core\MahApps.Metro.PrismApp.Core.csproj", "{7A3BBA6A-7DBC-47F4-9B5C-C134CE0BF515}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MahApps.Metro.PrismApp", "MahApps.Metro.PrismApp\MahApps.Metro.PrismApp.csproj", "{647164D4-5681-4FE3-B1B1-7F4FB719A845}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MahApps.Metro.PrismModule1", "MahApps.Metro.Prism.Module1\MahApps.Metro.PrismModule1.csproj", "{C02BF628-D36E-4DD1-8868-A0E55F3545AE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MahApps.Metro.PrismModule2", "MahApps.Metro.Prism.Module2\MahApps.Metro.PrismModule2.csproj", "{8F1CFC9E-3327-4AFB-B35E-DB1C64029994}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7A3BBA6A-7DBC-47F4-9B5C-C134CE0BF515}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7A3BBA6A-7DBC-47F4-9B5C-C134CE0BF515}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7A3BBA6A-7DBC-47F4-9B5C-C134CE0BF515}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7A3BBA6A-7DBC-47F4-9B5C-C134CE0BF515}.Release|Any CPU.Build.0 = Release|Any CPU
{647164D4-5681-4FE3-B1B1-7F4FB719A845}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{647164D4-5681-4FE3-B1B1-7F4FB719A845}.Debug|Any CPU.Build.0 = Debug|Any CPU
{647164D4-5681-4FE3-B1B1-7F4FB719A845}.Release|Any CPU.ActiveCfg = Release|Any CPU
{647164D4-5681-4FE3-B1B1-7F4FB719A845}.Release|Any CPU.Build.0 = Release|Any CPU
{C02BF628-D36E-4DD1-8868-A0E55F3545AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C02BF628-D36E-4DD1-8868-A0E55F3545AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C02BF628-D36E-4DD1-8868-A0E55F3545AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C02BF628-D36E-4DD1-8868-A0E55F3545AE}.Release|Any CPU.Build.0 = Release|Any CPU
{8F1CFC9E-3327-4AFB-B35E-DB1C64029994}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8F1CFC9E-3327-4AFB-B35E-DB1C64029994}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8F1CFC9E-3327-4AFB-B35E-DB1C64029994}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8F1CFC9E-3327-4AFB-B35E-DB1C64029994}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D5DF970B-F195-4A05-80FE-660A0E0AF05B}
EndGlobalSection
EndGlobal
25 changes: 25 additions & 0 deletions MahApps.Metro.Prism.Module1/MahApps.Metro.PrismModule1.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
<AssemblyName>MahApps.Metro.PrismModule1</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MahApps.Metro" Version="2.0.0-alpha0775" />
<PackageReference Include="MahApps.Metro.IconPacks.Material" Version="4.0.0" />
<PackageReference Include="Prism.Wpf" Version="7.2.0.1422" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MahApps.Metro.PrismApp.Core\MahApps.Metro.PrismApp.Core.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Views\Module1Flyout.xaml.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Page Update="Views\Module1Flyout.xaml">
<SubType>Designer</SubType>
</Page>
</ItemGroup>
</Project>
31 changes: 31 additions & 0 deletions MahApps.Metro.Prism.Module1/Module1Module.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using MahApps.Metro.PrismApp.Core;
using MahApps.Metro.PrismModule1.ViewModels;
using MahApps.Metro.PrismModule1.Views;
using Prism.Ioc;
using Prism.Modularity;
using Prism.Regions;

namespace MahApps.Metro.PrismModule1
{
public class Module1Module : IModule
{
private readonly IRegionManager _regionManager;

public Module1Module(IRegionManager regionManager)
{
_regionManager = regionManager;
}

public void OnInitialized(IContainerProvider containerProvider)
{
_regionManager.RegisterViewWithRegion(RegionNames.MenuRegion, typeof(Modul1Menu));
_regionManager.RegisterViewWithRegion(RegionNames.FlyoutRegion, typeof(Module1Flyout));
}

public void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.RegisterForNavigation<ViewA, ViewAViewModel>();
containerRegistry.RegisterForNavigation<ViewB, ViewBViewModel>();
}
}
}
15 changes: 15 additions & 0 deletions MahApps.Metro.Prism.Module1/ViewModels/Module1FlyoutViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using MahApps.Metro.Controls;
using MahApps.Metro.PrismApp.Core.Base;

namespace MahApps.Metro.PrismModule1.ViewModels
{
public class Module1FlyoutViewModel : FlyoutViewModelBase
{
public Module1FlyoutViewModel()
{
Tag = "Module1Flyout";
Header = "Module 1 Flyout";
Position = Position.Right;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Prism.Mvvm;

namespace MahApps.Metro.PrismModule1.ViewModels
{
public class Module1MenuViewModel : BindableBase
{
}
}
20 changes: 20 additions & 0 deletions MahApps.Metro.Prism.Module1/ViewModels/ViewAViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using MahApps.Metro.PrismApp.Core.Base;

namespace MahApps.Metro.PrismModule1.ViewModels
{
public class ViewAViewModel : ViewModelBase
{
private string _message;
public string Message
{
get { return _message; }
set { SetProperty(ref _message, value); }
}

public ViewAViewModel()
{
Title = "ViewA - M1";
Message = "View A from Module 1";
}
}
}
33 changes: 33 additions & 0 deletions MahApps.Metro.Prism.Module1/ViewModels/ViewBViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using MahApps.Metro.PrismApp.Core;
using MahApps.Metro.PrismApp.Core.Base;
using Prism.Commands;
using Prism.Events;

namespace MahApps.Metro.PrismModule1.ViewModels
{
public class ViewBViewModel : ViewModelBase
{
private readonly IEventAggregator _eventAggregator;
private string _message;
public string Message
{
get { return _message; }
set { SetProperty(ref _message, value); }
}

public ViewBViewModel(IEventAggregator eventAggregator)
{
Title = "ViewB - M1";
Message = "View B from Module 1";
_eventAggregator = eventAggregator;
}

private DelegateCommand<string> _toggleFlyoutCommand;
public DelegateCommand<string> ToggleFlyoutCommand => _toggleFlyoutCommand ?? (_toggleFlyoutCommand = new DelegateCommand<string>(ExecuteToggleFlyoutCommand));

private void ExecuteToggleFlyoutCommand(string tag)
{
_eventAggregator.GetEvent<ToggleFlyoutEvent>().Publish(new ToggleFlyoutEventArgs { FlyoutTag = tag });
}
}
}
11 changes: 11 additions & 0 deletions MahApps.Metro.Prism.Module1/Views/Module1Flyout.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<mah:Flyout x:Class="MahApps.Metro.PrismModule1.Views.Module1Flyout"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:prism="http://prismlibrary.com/"
Tag="{Binding Tag}"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
prism:ViewModelLocator.AutoWireViewModel="True">
<Grid>
<TextBlock>Hello from Module 1</TextBlock>
</Grid>
</mah:Flyout>
13 changes: 13 additions & 0 deletions MahApps.Metro.Prism.Module1/Views/Module1Flyout.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace MahApps.Metro.PrismModule1.Views
{
/// <summary>
/// Interaction logic for Module2Flyout
/// </summary>
public partial class Module1Flyout
{
public Module1Flyout()
{
InitializeComponent();
}
}
}
15 changes: 15 additions & 0 deletions MahApps.Metro.Prism.Module1/Views/Module1Menu.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<mah:HamburgerMenuItemCollection x:Class="MahApps.Metro.PrismModule1.Views.Modul1Menu"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mvvm="http://prismlibrary.com/"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
mvvm:ViewModelLocator.AutoWireViewModel="True"
mc:Ignorable="d">
<mah:HamburgerMenuHeaderItem Label="Module 1" />
<mah:HamburgerMenuIconItem Label="go to ViewA" Icon="{iconPacks:Material Kind=Home}" CommandParameter="ViewA"/>
<mah:HamburgerMenuIconItem Label="go to ViewB" Icon="{iconPacks:Material Kind=Account}" CommandParameter="ViewB"/>
<mah:HamburgerMenuSeparatorItem />
</mah:HamburgerMenuItemCollection>
18 changes: 18 additions & 0 deletions MahApps.Metro.Prism.Module1/Views/Module1Menu.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using MahApps.Metro.Controls;
using MahApps.Metro.PrismApp.Core;

namespace MahApps.Metro.PrismModule1.Views
{
/// <summary>
/// Interaction logic for AccordionMenuItem.xaml
/// </summary>
public partial class Modul1Menu : HamburgerMenuItemCollection, IMenuRootItem
{
public Modul1Menu()
{
InitializeComponent();
}

public string DefaultNavigationPath => nameof(ViewA);
}
}
17 changes: 17 additions & 0 deletions MahApps.Metro.Prism.Module1/Views/ViewA.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<UserControl x:Class="MahApps.Metro.PrismModule1.Views.ViewA"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
Background="LightYellow"
d:DesignHeight="300" d:DesignWidth="300"
xmlns:prism="http://prismlibrary.com/"
prism:ViewModelLocator.AutoWireViewModel="True" >
<Grid>
<TextBlock Text="{Binding Message}"
FontSize="16"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Grid>
</UserControl>
15 changes: 15 additions & 0 deletions MahApps.Metro.Prism.Module1/Views/ViewA.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Windows.Controls;

namespace MahApps.Metro.PrismModule1.Views
{
/// <summary>
/// Interaction logic for ViewA.xaml
/// </summary>
public partial class ViewA : UserControl
{
public ViewA()
{
InitializeComponent();
}
}
}
19 changes: 19 additions & 0 deletions MahApps.Metro.Prism.Module1/Views/ViewB.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<UserControl x:Class="MahApps.Metro.PrismModule1.Views.ViewB"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
Background="LightGreen"
d:DesignHeight="300" d:DesignWidth="300"
xmlns:prism="http://prismlibrary.com/"
prism:ViewModelLocator.AutoWireViewModel="True" >
<Grid>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="{Binding Message}" FontSize="16" />
<Button Margin="10" Content="Toggle Module 1 Flyout" Command="{Binding ToggleFlyoutCommand}" CommandParameter="Module1Flyout"/>

<Button Margin="10" Content="Toggle Module 2 Flyout" Command="{Binding ToggleFlyoutCommand}" CommandParameter="Module2Flyout"/>
</StackPanel>
</Grid>
</UserControl>
15 changes: 15 additions & 0 deletions MahApps.Metro.Prism.Module1/Views/ViewB.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Windows.Controls;

namespace MahApps.Metro.PrismModule1.Views
{
/// <summary>
/// Interaction logic for ViewB.xaml
/// </summary>
public partial class ViewB : UserControl
{
public ViewB()
{
InitializeComponent();
}
}
}
14 changes: 14 additions & 0 deletions MahApps.Metro.Prism.Module2/MahApps.Metro.PrismModule2.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
<AssemblyName>MahApps.Metro.PrismModule2</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MahApps.Metro" Version="2.0.0-alpha0775" />
<PackageReference Include="Prism.Wpf" Version="7.2.0.1422" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MahApps.Metro.PrismApp.Core\MahApps.Metro.PrismApp.Core.csproj" />
</ItemGroup>
</Project>
30 changes: 30 additions & 0 deletions MahApps.Metro.Prism.Module2/Module2Module.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using MahApps.Metro.PrismApp.Core;
using MahApps.Metro.PrismModule2.ViewModels;
using MahApps.Metro.PrismModule2.Views;
using Prism.Ioc;
using Prism.Modularity;
using Prism.Regions;

namespace MahApps.Metro.PrismModule2
{
public class Module2Module : IModule
{
private readonly IRegionManager _regionManager;

public Module2Module(IRegionManager regionManager)
{
_regionManager = regionManager;
}

public void OnInitialized(IContainerProvider containerProvider)
{
_regionManager.RegisterViewWithRegion(RegionNames.MenuRegion, typeof(Module2Menu));
_regionManager.RegisterViewWithRegion(RegionNames.FlyoutRegion, typeof(Module2Flyout));
}

public void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.RegisterForNavigation<ViewC, ViewCViewModel>();
}
}
}
15 changes: 15 additions & 0 deletions MahApps.Metro.Prism.Module2/ViewModels/Module2FlyoutViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using MahApps.Metro.Controls;
using MahApps.Metro.PrismApp.Core.Base;

namespace MahApps.Metro.PrismModule2.ViewModels
{
public class Module2FlyoutViewModel : FlyoutViewModelBase
{
public Module2FlyoutViewModel()
{
Tag = "Module2Flyout";
Header = "Module 2 Flyout";
Position = Position.Right;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Prism.Mvvm;

namespace MahApps.Metro.PrismModule2.ViewModels
{
public class Module2MenuViewModel : BindableBase
{
}
}
Loading

0 comments on commit 6ed2386

Please sign in to comment.