diff --git a/Marechai.App/Presentation/Converters/SidebarConverters.cs b/Marechai.App/Presentation/Converters/SidebarConverters.cs new file mode 100644 index 00000000..5605f84f --- /dev/null +++ b/Marechai.App/Presentation/Converters/SidebarConverters.cs @@ -0,0 +1,59 @@ +using System; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Data; + +namespace Marechai.App.Presentation.Converters; + +/// +/// Converts boolean value to collapse/expand arrow icon +/// +public class CollapseExpandIconConverter : IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, string language) + { + if(value is bool isOpen) return isOpen ? "◄" : "►"; + + return "►"; + } + + public object ConvertBack(object value, Type targetType, object parameter, string language) => + throw new NotImplementedException(); +} + +/// +/// Converts boolean value to collapse/expand tooltip text +/// +public class CollapseExpandTooltipConverter : IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, string language) + { + if(value is bool isOpen) return isOpen ? "Collapse Sidebar" : "Expand Sidebar"; + + return "Expand Sidebar"; + } + + public object ConvertBack(object value, Type targetType, object parameter, string language) => + throw new NotImplementedException(); +} + +/// +/// Converts boolean value to GridLength for sidebar column width +/// +public class SidebarWidthConverter : IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, string language) + { + if(value is bool isOpen) + { + // 280 when open, 60 when collapsed (to keep toggle button visible) + double width = isOpen ? 280 : 60; + + return new GridLength(width, GridUnitType.Pixel); + } + + return new GridLength(280, GridUnitType.Pixel); + } + + public object ConvertBack(object value, Type targetType, object parameter, string language) => + throw new NotImplementedException(); +} \ No newline at end of file diff --git a/Marechai.App/Presentation/MainPage.xaml b/Marechai.App/Presentation/MainPage.xaml index d0398720..37d70fc0 100644 --- a/Marechai.App/Presentation/MainPage.xaml +++ b/Marechai.App/Presentation/MainPage.xaml @@ -4,129 +4,159 @@ + + + + + + + + + - + + + + + - - - - - - - + + + + + + + + + - - - - - + + + + + - - - - - + + + + + - - - -