Не работает Binding в UserControl. Использую паттерн MVVM. Создал object свойство CurrentView, с помощью которого хочу менять контролы

Главное Окно:

<Window x:Class="EveryDayNote.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:EveryDayNote" 
        xmlns:viewmodel="clr-namespace:EveryDayNote.MVVM.ViewModel"
        mc:Ignorable="d" Height="635" Width="1200"
        Style="{StaticResource WindowStyle}">
    <Window.DataContext>
        <viewmodel:MainViewModel/>
    </Window.DataContext>
    <Window.InputBindings>
        <MouseBinding MouseAction="LeftClick"
                      Command="{Binding MoveWindowCommand}"/>
        
    </Window.InputBindings>
    <DockPanel>
        <Border Background="Transparent"
                DockPanel.Dock="Top"
                Height="35"
                BorderThickness="0 0 0 0.1">
            <Border.BorderBrush>
                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"
                                     Opacity="0.9">
                    <GradientStop Color="MidnightBlue" Offset="0.4"/>
                    <GradientStop Color="DarkGray" Offset="1"/>
                </LinearGradientBrush>
            </Border.BorderBrush>

            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="35"/>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="105"/>
                </Grid.ColumnDefinitions>                
                
                <TextBlock Grid.Column="1"
                           Text="EveryDayNote"
                           FontWeight="Medium"
                           FontSize="24"
                           VerticalAlignment="Center"/>

                <StackPanel  Orientation="Horizontal" Grid.Column="2"
                            HorizontalAlignment="Right">
                    <Button Content="?"
                            Style="{StaticResource TopButtonStyle}"
                            Command="{Binding LogginCommand}"/>
                    <Button Content="?"
                            Style="{StaticResource TopButtonStyle}"
                            Command="{Binding RegCommand}"/>
                    <Button Content="?"
                            Style="{StaticResource TopButtonStyle}"
                            Command="{Binding CloseAppCommand}"/>

                </StackPanel>
            </Grid>   
        </Border>

        <ContentControl Content="{Binding CurrentView}"
                          DockPanel.Dock="Bottom"
                          HorizontalAlignment="Stretch" 
                          VerticalAlignment="Stretch" 
                          Margin="5,5,5,5" IsManipulationEnabled="True">
        </ContentControl>

    </DockPanel>
</Window>

MainViewModel, где прописываю все команды:

using Core;
using System.Windows;

namespace EveryDayNote.MVVM.ViewModel
{
    internal class MainViewModel : ObservableObject
    {
        #region Fields
        private object _currentView;
        #endregion

        #region Properties
        public object CurrentView
        {
            get { return _currentView; }
            set
            {
                _currentView = value;
                OnPropertyChanged();
            }
        }
        #endregion

        #region Commands
        public RelayCommand CloseAppCommand { get; set; }
        public RelayCommand MoveWindowCommand { get; set; }
        public RelayCommand MinimizeWindowCommand { get; set; }
        public RelayCommand MaximizeWindowCommand { get; set; }
        public RelayCommand LogginCommand { get; set; }
        public RelayCommand RegCommand { get; set; }
        #endregion

        #region Views
        public LogginViewModel LogginViewModel { get; set; }
        public RegViewModel RegViewModel { get; set; }
        public AppViewModel AppViewModel { get; set; }
        #endregion

        
        public MainViewModel()
        {
            LogginViewModel = new LogginViewModel();
            AppViewModel = new AppViewModel();
            CurrentView = LogginViewModel;

            CloseAppCommand = new RelayCommand(o => { Application.Current.Shutdown(); });    
            MoveWindowCommand = new RelayCommand(o => { Application.Current.MainWindow.DragMove(); });
            MinimizeWindowCommand = new RelayCommand(o => { Application.Current.MainWindow.WindowState = WindowState.Minimized; });
            MaximizeWindowCommand = new RelayCommand(o => 
            {
                if (Application.Current.MainWindow.WindowState != WindowState.Maximized)
                {
                    Application.Current.MainWindow.WindowState = WindowState.Maximized;
                }
                else
                {
                    Application.Current.MainWindow.WindowState = WindowState.Normal;
                }

            });

            LogginCommand = new RelayCommand(o => { CurrentView = AppViewModel;});

            RegCommand = new RelayCommand(o => { CurrentView = RegViewModel; });

        }
    }
}

и LoginView, где пытаюсь привязать команду:

<UserControl x:Class="EveryDayNote.MVVM.View.LogginView"
             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:local="clr-namespace:EveryDayNote.MVVM.View" 
             xmlns:viewmodel="clr-namespace:EveryDayNote.MVVM.ViewModel"
             mc:Ignorable="d" 
             Height="600" Width="350"
             Style="{StaticResource CustonControlStyle}" IsManipulationEnabled="True">

    <UserControl.DataContext>
        <viewmodel:MainViewModel/>
    </UserControl.DataContext>
    <DockPanel>
        <Border DockPanel.Dock="Top"
                Height="200">
            <TextBlock Text="LOGGIN"
                       HorizontalAlignment="Center"
                       VerticalAlignment="Center"
                       FontSize="50"/>
        </Border>
        <Border>
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="80"/>
                    <RowDefinition Height="80"/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Border BorderBrush="LemonChiffon"
                        CornerRadius="10"
                        Height="50"
                        BorderThickness="2">
                    <TextBox Grid.Row="0" Background="Transparent"
                             Width="350" Height="50"
                             Foreground="LemonChiffon"
                             VerticalContentAlignment="Center"
                             FontSize="26"
                             BorderThickness="0"/>                    
                </Border>

                <Border BorderBrush="LemonChiffon"
                        CornerRadius="10"
                        Height="50"
                        BorderThickness="2"
                        Grid.Row="1">
                    <PasswordBox Background="Transparent"
                                 Width="350" Height="50"
                                 BorderThickness="0"
                                 Foreground="LemonChiffon"
                                 VerticalContentAlignment="Center"
                                 FontSize="26"/>
                </Border>   
                
                <StackPanel Grid.Row="2"
                            Margin="0 20 0 0">
                    <Button Content="Log In" 
                            Style="{StaticResource LogRegButton}"
                            Command="{Binding LogginCommand}"/>
                    <Button Content="Registration"
                            Margin="0 20 0 0"
                            Style="{StaticResource LogRegButton}"
                            Command="{Binding RegCommand}"/>
                </StackPanel>
            </Grid>
        </Border>            
    </DockPanel>
</UserControl>

App.xaml где задал DataTemplate:

<Application x:Class="EveryDayNote.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:EveryDayNote"
             xmlns:view="clr-namespace:EveryDayNote.MVVM.View"
             xmlns:viewmodel="clr-namespace:EveryDayNote.MVVM.ViewModel"
             StartupUri="/MVVM/View/MainWindow.xaml">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Themes/WindowStyle.xaml"/>
                <ResourceDictionary Source="/Themes/TopButtonStyle.xaml"/>
                <ResourceDictionary Source="/Themes/CustomControlStyle.xaml"/>
                <ResourceDictionary Source="/Themes/LogRegButton.xaml"/>               
            </ResourceDictionary.MergedDictionaries>

            <DataTemplate DataType="{x:Type viewmodel:LogginViewModel}">
                <view:LogginView/>
            </DataTemplate>
            <DataTemplate DataType="{x:Type viewmodel:RegViewModel}">
                <view:RegView/>
            </DataTemplate>
            <DataTemplate DataType="{x:Type viewmodel:AppViewModel}">
                <view:AppView/>
            </DataTemplate>  
            
        </ResourceDictionary>         
    </Application.Resources>
</Application>

Ответы (0 шт):