-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
210 additions
and
0 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
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,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/> | ||
</startup> | ||
</configuration> |
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,8 @@ | ||
<Application x:Class="Demo.Hierarchies.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="clr-namespace:Demo.Hierarchies"> | ||
<Application.Resources> | ||
|
||
</Application.Resources> | ||
</Application> |
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,41 @@ | ||
using Caliburn.Light; | ||
using Caliburn.Light.WPF; | ||
using System.Windows; | ||
|
||
namespace Demo.Hierarchies | ||
{ | ||
/// <summary> | ||
/// Interaction logic for App.xaml | ||
/// </summary> | ||
public partial class App : Application | ||
{ | ||
private SimpleContainer _container; | ||
|
||
public App() | ||
{ | ||
_container = new SimpleContainer(); | ||
|
||
_container.RegisterSingleton<IWindowManager, WindowManager>(); | ||
_container.RegisterSingleton<IEventAggregator, EventAggregator>(); | ||
_container.RegisterSingleton<IViewModelLocator, ViewModelLocator>(); | ||
|
||
var typeResolver = new ViewModelTypeResolver() | ||
.AddMapping<ShellView, ShellViewModel>() | ||
.AddMapping<ChildLevel1View, ChildLevel1ViewModel>() | ||
.AddMapping<ChildLevel2View, ChildLevel2ViewModel>(); | ||
_container.RegisterInstance<IViewModelTypeResolver>(typeResolver); | ||
|
||
_container.RegisterPerRequest<ShellViewModel>(); | ||
_container.RegisterPerRequest<ChildLevel1ViewModel>(); | ||
_container.RegisterPerRequest<ChildLevel2ViewModel>(); | ||
} | ||
|
||
protected override void OnStartup(StartupEventArgs e) | ||
{ | ||
base.OnStartup(e); | ||
|
||
_container.GetInstance<IWindowManager>() | ||
.ShowWindow(_container.GetInstance<ShellViewModel>()); | ||
} | ||
} | ||
} |
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,10 @@ | ||
using System.Windows; | ||
|
||
[assembly: ThemeInfo( | ||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located | ||
//(used if a resource is not found in the page, | ||
// or application resource dictionaries) | ||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located | ||
//(used if a resource is not found in the page, | ||
// app, or any theme specific resource dictionaries) | ||
)] |
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,13 @@ | ||
<UserControl x:Class="Demo.Hierarchies.ChildLevel1View" | ||
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:cal="https://github.com/tibel/Caliburn.Light/" | ||
mc:Ignorable="d" | ||
d:DesignHeight="300" d:DesignWidth="300"> | ||
<ContentControl HorizontalContentAlignment="Stretch" | ||
VerticalContentAlignment="Stretch" | ||
DataContext="{Binding ActiveItem, Mode=OneWay}" | ||
cal:View.Create="True" /> | ||
</UserControl> |
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,15 @@ | ||
using System.Windows.Controls; | ||
|
||
namespace Demo.Hierarchies | ||
{ | ||
/// <summary> | ||
/// Interaction logic for ChildLevel1View.xaml | ||
/// </summary> | ||
public partial class ChildLevel1View : UserControl | ||
{ | ||
public ChildLevel1View() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
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,12 @@ | ||
using Caliburn.Light; | ||
|
||
namespace Demo.Hierarchies | ||
{ | ||
public class ChildLevel1ViewModel : Conductor<Screen>.Collection.OneActive | ||
{ | ||
public ChildLevel1ViewModel(ChildLevel2ViewModel child) | ||
{ | ||
ActiveItem = child; | ||
} | ||
} | ||
} |
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,11 @@ | ||
<UserControl x:Class="Demo.Hierarchies.ChildLevel2View" | ||
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" | ||
d:DesignHeight="300" d:DesignWidth="300"> | ||
<Border Background="Aquamarine" | ||
HorizontalAlignment="Stretch" | ||
VerticalAlignment="Stretch" /> | ||
</UserControl> |
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,15 @@ | ||
using System.Windows.Controls; | ||
|
||
namespace Demo.Hierarchies | ||
{ | ||
/// <summary> | ||
/// Interaction logic for ChildLevel2View.xaml | ||
/// </summary> | ||
public partial class ChildLevel2View : UserControl | ||
{ | ||
public ChildLevel2View() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
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,8 @@ | ||
using Caliburn.Light; | ||
|
||
namespace Demo.Hierarchies | ||
{ | ||
public class ChildLevel2ViewModel : Screen | ||
{ | ||
} | ||
} |
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,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net6.0-windows</TargetFramework> | ||
<OutputType>WinExe</OutputType> | ||
<UseWPF>true</UseWPF> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\Caliburn.Light.Core\Caliburn.Light.Core.csproj" /> | ||
<ProjectReference Include="..\..\src\Caliburn.Light.WPF\Caliburn.Light.WPF.csproj" /> | ||
</ItemGroup> | ||
</Project> |
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,10 @@ | ||
<Window x:Class="Demo.Hierarchies.ShellView" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:cal="https://github.com/tibel/Caliburn.Light/" | ||
Title="Demo.Hierarchies" Height="350" Width="525"> | ||
<ContentControl HorizontalContentAlignment="Stretch" | ||
VerticalContentAlignment="Stretch" | ||
DataContext="{Binding ActiveItem, Mode=OneWay}" | ||
cal:View.Create="True" /> | ||
</Window> |
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,15 @@ | ||
using System.Windows; | ||
|
||
namespace Demo.Hierarchies | ||
{ | ||
/// <summary> | ||
/// Interaction logic for MainWindow.xaml | ||
/// </summary> | ||
public partial class ShellView : Window | ||
{ | ||
public ShellView() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
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,12 @@ | ||
using Caliburn.Light; | ||
|
||
namespace Demo.Hierarchies | ||
{ | ||
public class ShellViewModel : Conductor<ChildLevel1ViewModel>.Collection.OneActive | ||
{ | ||
public ShellViewModel(ChildLevel1ViewModel child) | ||
{ | ||
ActiveItem = child; | ||
} | ||
} | ||
} |