Katya il y a 5 mois
Parent
commit
4157d9380e

+ 4 - 1
ViewModels/MainWindowViewModel.cs

@@ -23,9 +23,12 @@ namespace YtYtAvalonia.ViewModels
 
         public void LoadRegistrationView() => UC = new RegistrationView();
 
+        public void LoadLoginView() => UC = new LoginView();
+
         LoginViewModel loginVM = new LoginViewModel();
-        public LoginViewModel LoginVM { get => loginVM; set => loginVM = value; }
 
+        
+        public LoginViewModel LoginVM { get => loginVM; set => loginVM = value; }
 
         public void LoadPersonalAccount()
         {

+ 1 - 2
Views/LoginView.axaml

@@ -44,8 +44,7 @@
 			</Button>
 			<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
 				<TextBlock Text="Нет аккаунта?" FontFamily="Roboto" FontSize="14" VerticalAlignment="Center"></TextBlock>
-				<Button Classes="Login" FontFamily="Roboto" FontSize="14" Background="White">Зарегистироваться</Button>
-				<!--<Button Classes="Login" FontFamily="Roboto" FontSize="14" Background="White" Command="{Binding $parent[Window].((vm.MainWindowViewModel)DataConext).LoadLoginView}">Войти</Button>-->
+				<Button Classes="Login" FontFamily="Roboto" FontSize="14" Background="White" Command="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).LoadRegistrationView}">Зарегистироваться</Button>
 			</StackPanel>
 		</StackPanel>
 	</Grid>

+ 8 - 2
Views/MainWindow.axaml

@@ -1,7 +1,7 @@
 <Window xmlns="https://github.com/avaloniaui"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:vm="using:YtYtAvalonia.ViewModels"
-        xmlns:v="using:YtYtAvalonia.View"
+        xmlns:v="using:YtYtAvalonia.Views"
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
@@ -17,6 +17,12 @@
         <vm:MainWindowViewModel/>
     </Design.DataContext>
 
-	<v:LoginView/>
+	<Grid >
+		<ScrollViewer>
+			<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
+				<ContentControl Content="{Binding UC}"></ContentControl>
+			</StackPanel>
+		</ScrollViewer>
+	</Grid>
 
 </Window>

+ 5 - 6
Views/RegistrationView.axaml

@@ -1,11 +1,11 @@
 <UserControl xmlns="https://github.com/avaloniaui"
              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:vm="using:YtYtAvalonia.ViewModels"
-			 x:DataType="vm:MainWindowViewModel"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
              mc:Ignorable="d" d:DesignWidth="1920" d:DesignHeight="1080"
-             x:Class="YtYtAvalonia.View.RegistrationView">
+             x:Class="YtYtAvalonia.Views.RegistrationView"
+			 x:DataType="vm:MainWindowViewModel">
 	<Grid>
 		<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
 
@@ -49,13 +49,12 @@
 			</StackPanel>
 			<TextBox Watermark="Элетронная почта" Width="360" FontSize="13" Margin="0 25 0 10" ></TextBox>
 			<TextBox Watermark="Номер телефона" Width="360" FontSize="13" Margin="0 0 0 25" ></TextBox>
-			<Button HorizontalAlignment="Center" Margin="0 20 0 10" Width="230" Height="45" CornerRadius="10" Background="#38BFF2">
+			<Button HorizontalAlignment="Center" Margin="0 20 0 10" Width="230" Height="45" CornerRadius="10" Background="#38BFF2" Command="{Binding LoadLoginView}">
 				<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontFamily="Roboto" FontSize="16" FontWeight="DemiBold" Foreground="White">Зарегистироваться</TextBlock>
 			</Button>
 			<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
 				<TextBlock Text="Уже есть аккаунт?" FontFamily="Roboto" FontSize="14" VerticalAlignment="Center"></TextBlock>
-				<Button Classes="Login" FontFamily="Roboto" FontSize="14" Background="White">Войти</Button>
-				<!--<Button Classes="Login" FontFamily="Roboto" FontSize="14" Background="White" Command="{Binding $parent[Window].((vm.MainWindowViewModel)DataConext).LoadLoginView}">Войти</Button>-->
+				<Button Classes="Login" FontFamily="Roboto" FontSize="14" Background="White" Command="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).LoadLoginView}">Войти</Button>
 			</StackPanel>
 		</StackPanel>
 	</Grid>

+ 2 - 4
Views/RegistrationView.axaml.cs

@@ -1,15 +1,13 @@
 using Avalonia;
 using Avalonia.Controls;
 using Avalonia.Markup.Xaml;
-using YtYtAvalonia.ViewModels;
-using YtYtAvalonia.Models;
 
-namespace YtYtAvalonia.View;
+namespace YtYtAvalonia.Views;
 
 public partial class RegistrationView : UserControl
 {
     public RegistrationView()
     {
-
+        InitializeComponent();
     }
 }