diff --git a/Wino.Mail/App.xaml b/Wino.Mail/App.xaml index bf1fe890..d2d05a9c 100644 --- a/Wino.Mail/App.xaml +++ b/Wino.Mail/App.xaml @@ -19,7 +19,9 @@ + + diff --git a/Wino.Mail/Controls/Advanced/WinoListView.cs b/Wino.Mail/Controls/Advanced/WinoListView.cs index 10f215da..219f8800 100644 --- a/Wino.Mail/Controls/Advanced/WinoListView.cs +++ b/Wino.Mail/Controls/Advanced/WinoListView.cs @@ -2,7 +2,6 @@ using System.Linq; using System.Windows.Input; using CommunityToolkit.Mvvm.Messaging; -using Microsoft.UI.Xaml.Controls; using MoreLinq; using Serilog; using Windows.UI.Xaml; @@ -356,7 +355,7 @@ namespace Wino.Controls.Advanced if (itemContainer is ListViewItem listItem) { - var expander = listItem.GetChildByName("ThreadExpander"); + var expander = listItem.GetChildByName("ThreadExpander"); if (expander != null) return expander.Content as WinoListView; diff --git a/Wino.Mail/Controls/MailItemDisplayInformationControl.xaml b/Wino.Mail/Controls/MailItemDisplayInformationControl.xaml index 889f633d..c8f931aa 100644 --- a/Wino.Mail/Controls/MailItemDisplayInformationControl.xaml +++ b/Wino.Mail/Controls/MailItemDisplayInformationControl.xaml @@ -3,14 +3,18 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:controls="using:Wino.Controls" - xmlns:enums="using:Wino.Core.Domain.Enums" xmlns:domain="using:Wino.Core.Domain" + xmlns:enums="using:Wino.Core.Domain.Enums" + xmlns:helpers="using:Wino.Helpers" + HorizontalAlignment="Stretch" + VerticalAlignment="Stretch" + HorizontalContentAlignment="Stretch" + VerticalContentAlignment="Stretch" FocusVisualMargin="8" FocusVisualPrimaryBrush="{StaticResource SystemControlRevealFocusVisualBrush}" FocusVisualPrimaryThickness="2" FocusVisualSecondaryBrush="{StaticResource SystemControlFocusVisualSecondaryBrush}" FocusVisualSecondaryThickness="1" - xmlns:helpers="using:Wino.Helpers" PointerEntered="ControlPointerEntered" PointerExited="ControlPointerExited"> @@ -25,26 +29,24 @@ - - - - - + + Canvas.ZIndex="9999" + Fill="{ThemeResource SystemAccentColor}" + Visibility="{x:Bind IsCustomFocused, Mode=OneWay}" /> - + @@ -243,7 +245,7 @@ - + @@ -255,7 +257,7 @@ - + diff --git a/Wino.Mail/Controls/MailItemDisplayInformationControl.xaml.cs b/Wino.Mail/Controls/MailItemDisplayInformationControl.xaml.cs index 4b080e1c..8c8c77d8 100644 --- a/Wino.Mail/Controls/MailItemDisplayInformationControl.xaml.cs +++ b/Wino.Mail/Controls/MailItemDisplayInformationControl.xaml.cs @@ -1,6 +1,5 @@ using System.Numerics; using System.Windows.Input; -using Microsoft.UI.Xaml.Controls; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Input; @@ -21,7 +20,7 @@ namespace Wino.Controls public static readonly DependencyProperty IsCustomFocusedProperty = DependencyProperty.Register(nameof(IsCustomFocused), typeof(bool), typeof(MailItemDisplayInformationControl), new PropertyMetadata(false)); public static readonly DependencyProperty IsAvatarVisibleProperty = DependencyProperty.Register(nameof(IsAvatarVisible), typeof(bool), typeof(MailItemDisplayInformationControl), new PropertyMetadata(true)); public static readonly DependencyProperty IsSubjectVisibleProperty = DependencyProperty.Register(nameof(IsSubjectVisible), typeof(bool), typeof(MailItemDisplayInformationControl), new PropertyMetadata(true)); - public static readonly DependencyProperty ConnectedExpanderProperty = DependencyProperty.Register(nameof(ConnectedExpander), typeof(Expander), typeof(MailItemDisplayInformationControl), new PropertyMetadata(null)); + public static readonly DependencyProperty ConnectedExpanderProperty = DependencyProperty.Register(nameof(ConnectedExpander), typeof(WinoExpander), typeof(MailItemDisplayInformationControl), new PropertyMetadata(null)); public static readonly DependencyProperty LeftHoverActionProperty = DependencyProperty.Register(nameof(LeftHoverAction), typeof(MailOperation), typeof(MailItemDisplayInformationControl), new PropertyMetadata(MailOperation.None)); public static readonly DependencyProperty CenterHoverActionProperty = DependencyProperty.Register(nameof(CenterHoverAction), typeof(MailOperation), typeof(MailItemDisplayInformationControl), new PropertyMetadata(MailOperation.None)); public static readonly DependencyProperty RightHoverActionProperty = DependencyProperty.Register(nameof(RightHoverAction), typeof(MailOperation), typeof(MailItemDisplayInformationControl), new PropertyMetadata(MailOperation.None)); @@ -73,9 +72,9 @@ namespace Wino.Controls } - public Expander ConnectedExpander + public WinoExpander ConnectedExpander { - get { return (Expander)GetValue(ConnectedExpanderProperty); } + get { return (WinoExpander)GetValue(ConnectedExpanderProperty); } set { SetValue(ConnectedExpanderProperty, value); } } @@ -167,16 +166,16 @@ namespace Wino.Controls // Also hover action button clicks will be delegated here after the execution runs. // We should not expand the thread if the reason we are here is for hover actions. - if (tappedHandlingFlag) - { - tappedHandlingFlag = false; - e.Handled = true; - return; - } + //if (tappedHandlingFlag) + //{ + // tappedHandlingFlag = false; + // e.Handled = true; + // return; + //} - if (ConnectedExpander == null) return; + //if (ConnectedExpander == null) return; - ConnectedExpander.IsExpanded = !ConnectedExpander.IsExpanded; + //ConnectedExpander.IsExpanded = !ConnectedExpander.IsExpanded; } private void FirstActionClicked(object sender, RoutedEventArgs e) diff --git a/Wino.Mail/Controls/WinoExpander.cs b/Wino.Mail/Controls/WinoExpander.cs index e407b6f2..3254d9d9 100644 --- a/Wino.Mail/Controls/WinoExpander.cs +++ b/Wino.Mail/Controls/WinoExpander.cs @@ -1,17 +1,43 @@ -using Microsoft.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Markup; namespace Wino.Controls { - public class WinoExpander : Expander + [ContentProperty(Name = nameof(Content))] + public class WinoExpander : Control { - protected override void OnApplyTemplate() + public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register(nameof(Header), typeof(UIElement), typeof(WinoExpander), new PropertyMetadata(null)); + public static readonly DependencyProperty ContentProperty = DependencyProperty.Register(nameof(Content), typeof(UIElement), typeof(WinoExpander), new PropertyMetadata(null)); + public static readonly DependencyProperty IsExpandedProperty = DependencyProperty.Register(nameof(IsExpanded), typeof(bool), typeof(WinoExpander), new PropertyMetadata(false, new PropertyChangedCallback(OnIsExpandedChanged))); + + public bool IsExpanded { - base.OnApplyTemplate(); - if (GetTemplateChild("ExpanderHeader") is ToggleButton toggleButton) - { - toggleButton.Padding = new Windows.UI.Xaml.Thickness(0, 4, 0, 4); - } + get { return (bool)GetValue(IsExpandedProperty); } + set { SetValue(IsExpandedProperty, value); } + } + + public UIElement Content + { + get { return (UIElement)GetValue(ContentProperty); } + set { SetValue(ContentProperty, value); } + } + + public UIElement Header + { + get { return (UIElement)GetValue(HeaderProperty); } + set { SetValue(HeaderProperty, value); } + } + + private static void OnIsExpandedChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args) + { + if (obj is WinoExpander control) + control.UpdateVisualStates(); + } + + private void UpdateVisualStates() + { + VisualStateManager.GoToState(this, IsExpanded ? "Expanded" : "Collapsed", true); } } } diff --git a/Wino.Mail/Styles/WinoExpanderStyle.xaml b/Wino.Mail/Styles/WinoExpanderStyle.xaml new file mode 100644 index 00000000..73358147 --- /dev/null +++ b/Wino.Mail/Styles/WinoExpanderStyle.xaml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Wino.Mail/Styles/WinoExpanderStyle.xaml.cs b/Wino.Mail/Styles/WinoExpanderStyle.xaml.cs new file mode 100644 index 00000000..817d086d --- /dev/null +++ b/Wino.Mail/Styles/WinoExpanderStyle.xaml.cs @@ -0,0 +1,12 @@ +using Windows.UI.Xaml; + +namespace Wino.Styles +{ + partial class WinoExpanderStyle : ResourceDictionary + { + public WinoExpanderStyle() + { + this.InitializeComponent(); + } + } +} diff --git a/Wino.Mail/Views/MailListPage.xaml b/Wino.Mail/Views/MailListPage.xaml index 61328647..a975f51a 100644 --- a/Wino.Mail/Views/MailListPage.xaml +++ b/Wino.Mail/Views/MailListPage.xaml @@ -158,18 +158,14 @@ - + - - + + - + @@ -273,6 +269,7 @@ x:Name="MailListContainer" Grid.Column="0" Padding="5,0,0,0" + HorizontalAlignment="Stretch" Background="{ThemeResource WinoContentZoneBackgroud}" BorderBrush="{StaticResource CardStrokeColorDefaultBrush}" BorderThickness="1" @@ -570,6 +567,7 @@ CustomMessageDialogStyles.xaml + + WinoExpanderStyle.xaml + @@ -529,6 +532,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile