diff --git a/critterfolio/CritterFolio/CritterFolio/Pages/CritterPage.axaml.cs b/critterfolio/CritterFolio/CritterFolio/Pages/CritterPage.axaml.cs
index 50147c6..9131be3 100644
--- a/critterfolio/CritterFolio/CritterFolio/Pages/CritterPage.axaml.cs
+++ b/critterfolio/CritterFolio/CritterFolio/Pages/CritterPage.axaml.cs
@@ -163,6 +163,21 @@ public partial class CritterPage : Page
private void CreateHeaderButtons()
{
+ if (_critter is null) return;
+
+ var treeBttn = new Button()
+ {
+ Classes = { "headerBttn" },
+ Content = "\ue6da"
+ };
+ treeBttn.Click += (sender, args) =>
+ {
+ var page = new FamilyTreePage();
+ page.Init(_critter);
+ Sys.Navigation?.PushPage(page);
+ };
+ Sys.Navigation?.AddHeaderButton(treeBttn);
+
var saveBttn = new Button()
{
Classes = { "headerBttn" },
diff --git a/critterfolio/CritterFolio/CritterFolio/Pages/FamilyTreePage.axaml b/critterfolio/CritterFolio/CritterFolio/Pages/FamilyTreePage.axaml
new file mode 100644
index 0000000..b1a2c91
--- /dev/null
+++ b/critterfolio/CritterFolio/CritterFolio/Pages/FamilyTreePage.axaml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/critterfolio/CritterFolio/CritterFolio/Pages/FamilyTreePage.axaml.cs b/critterfolio/CritterFolio/CritterFolio/Pages/FamilyTreePage.axaml.cs
new file mode 100644
index 0000000..e42d227
--- /dev/null
+++ b/critterfolio/CritterFolio/CritterFolio/Pages/FamilyTreePage.axaml.cs
@@ -0,0 +1,62 @@
+using System.Collections.Generic;
+using System.Linq;
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Layout;
+using Avalonia.Markup.Xaml;
+using CritterFolio.DataModels;
+using CritterFolio.Services;
+
+namespace CritterFolio.Pages;
+
+public partial class FamilyTreePage : Page
+{
+ private Critter? _critter;
+ private Dictionary _critters = [];
+
+ public FamilyTreePage()
+ {
+ InitializeComponent();
+ }
+
+ public void Init(Critter critter)
+ {
+ _critter = critter;
+ }
+
+ public override void Refresh()
+ {
+ RebuildCritterDict();
+ }
+
+ private async void RebuildCritterDict()
+ {
+ if (_critter is null) return;
+
+ ChildStack.Children.Clear();
+
+ var allCritters = await DatabaseService.GetAllCritters();
+
+ var mother = allCritters.FirstOrDefault(c => c.Id == _critter.MotherId);
+ var father = allCritters.FirstOrDefault(c => c.Id == _critter.FatherId);
+ var children = allCritters.Where(c => c.MotherId == _critter.Id || c.FatherId == _critter.Id).ToList();
+
+ var motherName = mother?.Name ?? "Not Set";
+ var fatherName = father?.Name ?? "Not Set";
+
+ MotherName.Text = $"[Mother]\n{motherName}";
+ FatherName.Text = $"[Father]\n{fatherName}";
+ CritterName.Text = _critter.Name;
+
+ foreach (var child in children)
+ {
+ var border = new Border
+ {
+ Classes = { "critter-card child" },
+ Child = new TextBlock {Text = $"[Child]\n{child.Name}"}
+ };
+
+ ChildStack.Children.Add(border);
+ }
+ }
+}
\ No newline at end of file
diff --git a/critterfolio/CritterFolio/CritterFolio/Pages/HomePage.axaml.cs b/critterfolio/CritterFolio/CritterFolio/Pages/HomePage.axaml.cs
index e30619d..9c57fd4 100644
--- a/critterfolio/CritterFolio/CritterFolio/Pages/HomePage.axaml.cs
+++ b/critterfolio/CritterFolio/CritterFolio/Pages/HomePage.axaml.cs
@@ -134,5 +134,6 @@ public partial class HomePage : Page
protected override void ClearConnections()
{
AddButton.Click -= AddButtonClicked;
+ SearchButton.Click -= SearchClicked;
}
}
\ No newline at end of file
diff --git a/critterfolio/CritterFolio/CritterFolio/Styles/MainStyles.axaml b/critterfolio/CritterFolio/CritterFolio/Styles/MainStyles.axaml
index a437b16..f912214 100644
--- a/critterfolio/CritterFolio/CritterFolio/Styles/MainStyles.axaml
+++ b/critterfolio/CritterFolio/CritterFolio/Styles/MainStyles.axaml
@@ -45,4 +45,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+