Files
Wino-Mail/Wino.Calendar/Views/CalendarPage.xaml

176 lines
9.7 KiB
Plaintext
Raw Normal View History

<abstract:CalendarPageAbstract
x:Class="Wino.Calendar.Views.CalendarPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:abstract="using:Wino.Calendar.Views.Abstract"
xmlns:calendarControls="using:Wino.Calendar.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:helpers="using:Wino.Helpers"
xmlns:local="using:Wino.Calendar.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:shared="using:Wino.Core.Domain.Entities.Shared"
mc:Ignorable="d">
2024-12-28 20:42:03 +01:00
<Page.Resources>
<!-- Teaching tip dialog sizing. -->
<x:Double x:Key="TeachingTipMinWidth">900</x:Double>
<x:Double x:Key="TeachingTipMaxWidth">900</x:Double>
<CollectionViewSource
x:Key="AQ"
IsSourceGrouped="True"
Source="{x:Bind ViewModel.AccountCalendarStateService.GroupedAccountCalendarsEnumerable, Mode=OneWay}" />
</Page.Resources>
2024-12-28 20:42:03 +01:00
<Border
Margin="0,0,7,7"
BorderBrush="{StaticResource CardStrokeColorDefaultBrush}"
BorderThickness="1"
CornerRadius="7">
<Grid>
<calendarControls:WinoCalendarControl
x:Name="CalendarControl"
DayRanges="{x:Bind ViewModel.DayRanges}"
IsHitTestVisible="{x:Bind ViewModel.IsCalendarEnabled, Mode=OneWay}"
SelectedFlipViewDayRange="{x:Bind ViewModel.SelectedDayRange, Mode=TwoWay}"
SelectedFlipViewIndex="{x:Bind ViewModel.SelectedDateRangeIndex, Mode=TwoWay}"
TimelineCellSelected="CellSelected"
TimelineCellUnselected="CellUnselected" />
<Canvas x:Name="CalendarOverlayCanvas" IsHitTestVisible="False">
<!-- Invisible target UI element for teaching tip display. -->
<Grid
x:Name="TeachingTipPositionerGrid"
Background="Transparent"
Visibility="Visible" />
<!-- Single teaching tip to display create event dialog. -->
<muxc:TeachingTip
x:Name="NewEventTip"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
Closed="CreateEventTipClosed"
IsOpen="False"
PreferredPlacement="Right"
Target="{x:Bind TeachingTipPositionerGrid}">
<muxc:TeachingTip.Content>
<Grid
Margin="-12"
Padding="6,3,6,6"
RowSpacing="12">
<Grid.RowDefinitions>
<RowDefinition Height="32" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="32" />
</Grid.ColumnDefinitions>
<!-- Title background -->
<Grid
Grid.ColumnSpan="2"
Margin="-6,-3,-6,-6"
Background="{x:Bind helpers:XamlHelpers.GetSolidColorBrushFromHex(ViewModel.SelectedQuickEventAccountCalendar.BackgroundColorHex), Mode=OneWay, TargetNullValue='LightGray'}" />
<!-- Title and close button area. -->
<Grid VerticalAlignment="Top" ColumnSpacing="6">
<Button
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
Background="Transparent">
<Button.Content>
<Grid ColumnSpacing="12">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Foreground="{x:Bind helpers:XamlHelpers.GetReadableTextColor(ViewModel.SelectedQuickEventAccountCalendar.BackgroundColorHex), Mode=OneWay}" Text="{x:Bind ViewModel.SelectedQuickEventAccountCalendar.Account.Name, Mode=OneWay}" />
<TextBlock
Grid.Column="1"
HorizontalAlignment="Right"
FontWeight="SemiBold"
Foreground="{x:Bind helpers:XamlHelpers.GetReadableTextColor(ViewModel.SelectedQuickEventAccountCalendar.BackgroundColorHex), Mode=OneWay}"
Text="{x:Bind ViewModel.SelectedQuickEventAccountCalendarName, Mode=OneWay}"
TextTrimming="CharacterEllipsis" />
<Viewbox Grid.Column="2" Width="12">
<PathIcon
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="F1 M 18.935547 4.560547 L 19.814453 5.439453 L 10 15.253906 L 0.185547 5.439453 L 1.064453 4.560547 L 10 13.496094 Z "
Foreground="{x:Bind helpers:XamlHelpers.GetReadableTextColor(ViewModel.SelectedQuickEventAccountCalendar.BackgroundColorHex), Mode=OneWay}" />
</Viewbox>
</Grid>
</Button.Content>
<Button.Flyout>
<Flyout x:Name="QuickEventAccountSelectorFlyout" Placement="Bottom">
<ListView
MaxHeight="300"
HorizontalAlignment="Stretch"
DisplayMemberPath="Name"
ItemsSource="{Binding Source={StaticResource AQ}}"
SelectedItem="{x:Bind ViewModel.SelectedQuickEventAccountCalendar, Mode=TwoWay}"
SelectionChanged="QuickEventAccountSelectorSelectionChanged">
<ListView.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Key.Name}" />
</DataTemplate>
</GroupStyle.HeaderTemplate>
</GroupStyle>
</ListView.GroupStyle>
</ListView>
</Flyout>
</Button.Flyout>
</Button>
<!--<ComboBox
HorizontalAlignment="Stretch"
DisplayMemberPath="Account.Name"
ItemsSource="{x:Bind ViewModel.AccountCalendarStateService.GroupedAccountCalendars}"
SelectedItem="{x:Bind ViewModel.SelectedQuickEventAccountCalendarGroup, Mode=TwoWay}" />-->
<!--<ComboBox
Grid.Column="1"
HorizontalAlignment="Stretch"
DisplayMemberPath="Name"
ItemsSource="{x:Bind ViewModel.SelectedQuickEventAccountCalendarGroup.AccountCalendars, Mode=OneWay}"
SelectedItem="{x:Bind ViewModel.SelectedQuickEventAccountCalendar, Mode=TwoWay}" />-->
</Grid>
<!-- Rest of the content -->
<Grid
Grid.Row="1"
Grid.ColumnSpan="2"
Height="200" />
<!--<TimePicker x:Name="EventTimePicker" ClockIdentifier="24HourClock" />-->
<!-- Create events dialog -->
<!--<Button
x:Name="AddEvent"
Grid.Row="1"
Click="AddEventClicked"
Content="Add Event" />-->
</Grid>
</muxc:TeachingTip.Content>
</muxc:TeachingTip>
</Canvas>
</Grid>
</Border>
</abstract:CalendarPageAbstract>