Skip to content

Commit

Permalink
created the home view
Browse files Browse the repository at this point in the history
  • Loading branch information
cabiste69 committed Jul 22, 2023
1 parent abc8c18 commit ecf0a4a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Controllers/MainController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Diagnostics;
using Avalonia.Controls;
using Avalonia.Interactivity;
using CatApp.Views.Home;
using CatApp.Views.Main;

namespace CatApp.Controllers;
Expand All @@ -16,6 +17,7 @@ public MainController(MainWindow view)
_view = view;
ConfigureMainHeader();
ConfigureSideBar();
InitializeMainContent();
}

/// <summary>
Expand Down Expand Up @@ -54,7 +56,7 @@ private void ChangeView(object? sender, RoutedEventArgs e)
switch (ViewName)
{
case "Home":
Console.WriteLine("Clicked on the 'home' button.");
_view.MainContentArea.Content = new HomeView();
break;

case "Counter":
Expand Down Expand Up @@ -89,4 +91,9 @@ private void OpenLink(object? sender, RoutedEventArgs e)
// start a process with the defined info
Process.Start(startInfo);
}

private void InitializeMainContent()
{
_view.MainContentArea.Content = new HomeView();
}
}
20 changes: 20 additions & 0 deletions Views/Home/HomeView.axaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<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"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="CatApp.Views.Home.HomeView">

<StackPanel Margin="22" Spacing="15">
<TextBlock FontSize="50">Hello, EveryNya!</TextBlock>

<TextBlock FontSize="16">Welcome to AvaloNya!</TextBlock>

<Border CornerRadius="4" Background="#282b2c" HorizontalAlignment="Left">
<TextBlock FontSize="16" Padding="20">
Did you know? The average cat can jump 8 feet (2.4 meters) in a single bound!
</TextBlock>
</Border>
</StackPanel>

</UserControl>
11 changes: 11 additions & 0 deletions Views/Home/HomeView.axaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Avalonia.Controls;

namespace CatApp.Views.Home;

public partial class HomeView : UserControl
{
public HomeView()
{
InitializeComponent();
}
}

0 comments on commit ecf0a4a

Please sign in to comment.