diff --git a/Wino.Mail.WinUI/Controls/AppModeFooterSwitcherControl.xaml b/Wino.Mail.WinUI/Controls/AppModeFooterSwitcherControl.xaml
index 1cb5188b..3c1e134d 100644
--- a/Wino.Mail.WinUI/Controls/AppModeFooterSwitcherControl.xaml
+++ b/Wino.Mail.WinUI/Controls/AppModeFooterSwitcherControl.xaml
@@ -1,38 +1,32 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Wino.Mail.WinUI/Controls/AppModeFooterSwitcherControl.xaml.cs b/Wino.Mail.WinUI/Controls/AppModeFooterSwitcherControl.xaml.cs
index 9869d8c6..cce5742f 100644
--- a/Wino.Mail.WinUI/Controls/AppModeFooterSwitcherControl.xaml.cs
+++ b/Wino.Mail.WinUI/Controls/AppModeFooterSwitcherControl.xaml.cs
@@ -1,4 +1,4 @@
-using System;
+using CommunityToolkit.WinUI.Controls;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
@@ -8,12 +8,25 @@ using Wino.Core.Domain;
namespace Wino.Mail.WinUI.Controls;
-public sealed partial class AppModeFooterSwitcherControl : UserControl
+public sealed partial class AppModeFooterSwitcherControl : Segmented
{
+ private const double VerticalItemExtent = 44;
private readonly IStatePersistanceService _statePersistenceService;
private readonly INavigationService _navigationService;
private bool _isUpdatingSelection;
+ public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register(
+ nameof(Orientation),
+ typeof(Orientation),
+ typeof(AppModeFooterSwitcherControl),
+ new PropertyMetadata(Orientation.Horizontal, OnOrientationChanged));
+
+ public Orientation Orientation
+ {
+ get => (Orientation)GetValue(OrientationProperty);
+ set => SetValue(OrientationProperty, value);
+ }
+
public AppModeFooterSwitcherControl()
{
_statePersistenceService = WinoApplication.Current.Services.GetRequiredService();
@@ -22,9 +35,15 @@ public sealed partial class AppModeFooterSwitcherControl : UserControl
InitializeComponent();
}
+ private static void OnOrientationChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs _)
+ {
+ ((AppModeFooterSwitcherControl)dependencyObject).UpdateOrientationState();
+ }
+
private void ControlLoaded(object sender, RoutedEventArgs e)
{
_statePersistenceService.StatePropertyChanged += StatePropertyChanged;
+ UpdateOrientationState();
UpdateSelection(_statePersistenceService.ApplicationMode);
}
@@ -45,14 +64,14 @@ public sealed partial class AppModeFooterSwitcherControl : UserControl
if (_isUpdatingSelection)
return;
- if (ModeSegmentedControl.SelectedIndex == 3)
+ if (SelectedIndex == 3)
{
_navigationService.Navigate(WinoPage.SettingsPage);
UpdateSelection(_statePersistenceService.ApplicationMode);
return;
}
- var selectedMode = ModeSegmentedControl.SelectedIndex switch
+ var selectedMode = SelectedIndex switch
{
1 => WinoApplicationMode.Calendar,
2 => WinoApplicationMode.Contacts,
@@ -68,7 +87,7 @@ public sealed partial class AppModeFooterSwitcherControl : UserControl
private void UpdateSelection(WinoApplicationMode mode)
{
_isUpdatingSelection = true;
- ModeSegmentedControl.SelectedIndex = mode switch
+ SelectedIndex = mode switch
{
WinoApplicationMode.Calendar => 1,
WinoApplicationMode.Contacts => 2,
@@ -76,4 +95,24 @@ public sealed partial class AppModeFooterSwitcherControl : UserControl
};
_isUpdatingSelection = false;
}
+
+ private void UpdateOrientationState()
+ {
+ foreach (var item in Items)
+ {
+ if (item is not SegmentedItem segmentedItem)
+ continue;
+
+ if (Orientation == Orientation.Vertical)
+ {
+ segmentedItem.Width = VerticalItemExtent;
+ segmentedItem.Height = VerticalItemExtent;
+ }
+ else
+ {
+ segmentedItem.ClearValue(WidthProperty);
+ segmentedItem.ClearValue(HeightProperty);
+ }
+ }
+ }
}
diff --git a/Wino.Mail.WinUI/Controls/Calendar/WinoCalendarFlipView.cs b/Wino.Mail.WinUI/Controls/Calendar/WinoCalendarFlipView.cs
index c1bdadaf..145adebf 100644
--- a/Wino.Mail.WinUI/Controls/Calendar/WinoCalendarFlipView.cs
+++ b/Wino.Mail.WinUI/Controls/Calendar/WinoCalendarFlipView.cs
@@ -115,10 +115,16 @@ public partial class WinoCalendarFlipView : CustomCalendarFlipView, IDisposable
private void UpdateActiveElements()
{
+ var itemsSource = GetItemsSource();
+
if (SelectedIndex < 0)
{
- ActiveCanvas = null;
- ActiveVerticalScrollViewer = null;
+ if (itemsSource == null || itemsSource.Count == 0)
+ {
+ ActiveCanvas = null;
+ ActiveVerticalScrollViewer = null;
+ }
+
return;
}
@@ -130,9 +136,7 @@ public partial class WinoCalendarFlipView : CustomCalendarFlipView, IDisposable
}
else
{
- // Container not ready yet - will be updated when OnContainerPrepared is called
- ActiveCanvas = null;
- ActiveVerticalScrollViewer = null;
+ // Container not ready yet - keep the current active elements until OnContainerPrepared updates them.
}
}
diff --git a/Wino.Mail.WinUI/Properties/launchSettings.json b/Wino.Mail.WinUI/Properties/launchSettings.json
index 52fff1db..14643837 100644
--- a/Wino.Mail.WinUI/Properties/launchSettings.json
+++ b/Wino.Mail.WinUI/Properties/launchSettings.json
@@ -3,7 +3,7 @@
"Wino.Mail.WinUI (Package)": {
"commandName": "MsixPackage",
"doNotLaunchApp": false,
- "nativeDebugging": false
+ "nativeDebugging": true
},
"Wino.Mail.WinUI (Unpackaged)": {
"commandName": "Project"
diff --git a/Wino.Mail.WinUI/Styles/CalendarShellNavigationViewStyle.xaml b/Wino.Mail.WinUI/Styles/CalendarShellNavigationViewStyle.xaml
index 3f4b57c3..d8c64cd3 100644
--- a/Wino.Mail.WinUI/Styles/CalendarShellNavigationViewStyle.xaml
+++ b/Wino.Mail.WinUI/Styles/CalendarShellNavigationViewStyle.xaml
@@ -7,6 +7,10 @@
xmlns:primitives="using:Microsoft.UI.Xaml.Controls.Primitives"
xmlns:winoControls="using:Wino.Mail.WinUI.Controls">
+
+
+
+