- Changed ShellViewModel to use Conductor<T>
- Added MainView/ViewModel - Changed MainViewModel to use Conductor<T>.StackNavigation - Changed ShellView to use ContentControl that displays MainViewModel
This commit is contained in:
parent
f8bae2ea7f
commit
a215d8de82
|
@ -0,0 +1,23 @@
|
|||
<UserControl x:Class="DynamicMenu.Pages.MainView"
|
||||
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:s="https://github.com/canton7/Stylet"
|
||||
xmlns:local="clr-namespace:DynamicMenu.Pages"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance local:MainViewModel}"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="COMPANY NAME" FontSize="20" FontWeight="Bold" HorizontalAlignment="Center" Margin="0,5" />
|
||||
|
||||
<StatusBar Grid.Row="2">
|
||||
<StatusBarItem Content="Ready" />
|
||||
</StatusBar>
|
||||
</Grid>
|
||||
</UserControl>
|
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace DynamicMenu.Pages
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainView.xaml
|
||||
/// </summary>
|
||||
public partial class MainView : UserControl
|
||||
{
|
||||
public MainView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
using System;
|
||||
using Stylet;
|
||||
|
||||
namespace DynamicMenu.Pages
|
||||
{
|
||||
public class MainViewModel : Conductor<IScreen>.StackNavigation
|
||||
{
|
||||
}
|
||||
}
|
|
@ -7,10 +7,6 @@
|
|||
xmlns:local="clr-namespace:Company.WpfApplication1.Pages"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance local:ShellViewModel}"
|
||||
Title="Stylet Project" Height="450" Width="800">
|
||||
<Grid>
|
||||
<TextBlock FontSize="30" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
Hello Stylet!
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
Title="Stylet Dynamic Menu" Height="600" Width="1200">
|
||||
<ContentControl s:View.Model="{Binding MainVM}" />
|
||||
</Window>
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
using Stylet;
|
||||
using DynamicMenu.Pages;
|
||||
using Stylet;
|
||||
|
||||
namespace Company.WpfApplication1.Pages
|
||||
{
|
||||
public class ShellViewModel : Screen
|
||||
public class ShellViewModel : Conductor<IScreen>
|
||||
{
|
||||
public MainViewModel MainVM { get; set; }
|
||||
|
||||
public ShellViewModel()
|
||||
{
|
||||
MainVM = new MainViewModel();
|
||||
this.ActivateItem(MainVM);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue