|
3 | 3 | x:Class="XCalendar.Forms.Views.DayView"
|
4 | 4 | xmlns="http://xamarin.com/schemas/2014/forms"
|
5 | 5 | xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
| 6 | + xmlns:Converters="clr-namespace:XCalendar.Forms.Converters" |
| 7 | + xmlns:Interfaces="clr-namespace:XCalendar.Forms.Interfaces" |
| 8 | + xmlns:System="clr-namespace:System;assembly=System.Runtime" |
6 | 9 | xmlns:xc="clr-namespace:XCalendar.Forms.Views"
|
7 | 10 | x:Name="DayView_Unique"
|
8 | 11 | x:DataType="{x:Type xc:DayView}">
|
9 | 12 |
|
10 |
| - <Label |
11 |
| - CharacterSpacing="{Binding CharacterSpacing, Source={x:Reference DayView_Unique}}" |
12 |
| - FontAttributes="{Binding FontAttributes, Source={x:Reference DayView_Unique}}" |
13 |
| - FontFamily="{Binding FontFamily, Source={x:Reference DayView_Unique}}" |
14 |
| - FontSize="{Binding FontSize, Source={x:Reference DayView_Unique}}" |
15 |
| - FormattedText="{Binding FormattedText, Source={x:Reference DayView_Unique}}" |
16 |
| - HorizontalTextAlignment="{Binding HorizontalTextAlignment, Source={x:Reference DayView_Unique}}" |
17 |
| - LineBreakMode="{Binding LineBreakMode, Source={x:Reference DayView_Unique}}" |
18 |
| - LineHeight="{Binding LineHeight, Source={x:Reference DayView_Unique}}" |
19 |
| - MaxLines="{Binding MaxLines, Source={x:Reference DayView_Unique}}" |
20 |
| - Text="{Binding Text, Source={x:Reference DayView_Unique}}" |
21 |
| - TextColor="{Binding TextColor, Source={x:Reference DayView_Unique}}" |
22 |
| - TextDecorations="{Binding TextDecorations, Source={x:Reference DayView_Unique}}" |
23 |
| - TextTransform="{Binding TextTransform, Source={x:Reference DayView_Unique}}" |
24 |
| - TextType="{Binding TextType, Source={x:Reference DayView_Unique}}" |
25 |
| - VerticalTextAlignment="{Binding VerticalTextAlignment, Source={x:Reference DayView_Unique}}"/> |
| 13 | + <Grid RowSpacing="2"> |
| 14 | + |
| 15 | + <Grid.RowDefinitions> |
| 16 | + <RowDefinition Height="1.5*"/> |
| 17 | + <RowDefinition Height="*"/> |
| 18 | + </Grid.RowDefinitions> |
| 19 | + |
| 20 | + <Label |
| 21 | + Grid.Row="0" |
| 22 | + Grid.RowSpan="2" |
| 23 | + CharacterSpacing="{Binding CharacterSpacing, Source={x:Reference DayView_Unique}}" |
| 24 | + FontAttributes="{Binding FontAttributes, Source={x:Reference DayView_Unique}}" |
| 25 | + FontFamily="{Binding FontFamily, Source={x:Reference DayView_Unique}}" |
| 26 | + FontSize="{Binding FontSize, Source={x:Reference DayView_Unique}}" |
| 27 | + FormattedText="{Binding FormattedText, Source={x:Reference DayView_Unique}}" |
| 28 | + HorizontalTextAlignment="{Binding HorizontalTextAlignment, Source={x:Reference DayView_Unique}}" |
| 29 | + LineBreakMode="{Binding LineBreakMode, Source={x:Reference DayView_Unique}}" |
| 30 | + LineHeight="{Binding LineHeight, Source={x:Reference DayView_Unique}}" |
| 31 | + MaxLines="{Binding MaxLines, Source={x:Reference DayView_Unique}}" |
| 32 | + Text="{Binding Text, Source={x:Reference DayView_Unique}}" |
| 33 | + TextColor="{Binding TextColor, Source={x:Reference DayView_Unique}}" |
| 34 | + TextDecorations="{Binding TextDecorations, Source={x:Reference DayView_Unique}}" |
| 35 | + TextTransform="{Binding TextTransform, Source={x:Reference DayView_Unique}}" |
| 36 | + TextType="{Binding TextType, Source={x:Reference DayView_Unique}}" |
| 37 | + VerticalOptions="Center" |
| 38 | + VerticalTextAlignment="{Binding VerticalTextAlignment, Source={x:Reference DayView_Unique}}"/> |
| 39 | + |
| 40 | + <ContentView Grid.Row="1" ControlTemplate="{Binding EventsTemplate, Source={x:Reference DayView_Unique}}"> |
| 41 | + <StackLayout |
| 42 | + BindableLayout.ItemsSource="{Binding Events, Source={x:Reference DayView_Unique}}" |
| 43 | + HorizontalOptions="Center" |
| 44 | + Orientation="{Binding EventsOrientation, Source={x:Reference DayView_Unique}}" |
| 45 | + Spacing="{Binding EventsSpacing, Source={x:Reference DayView_Unique}}"> |
| 46 | + |
| 47 | + <StackLayout.Resources> |
| 48 | + <System:Boolean x:Key="TrueValue">True</System:Boolean> |
| 49 | + <System:Boolean x:Key="FalseValue">False</System:Boolean> |
| 50 | + |
| 51 | + <Converters:IsNullOrEmptyConverter x:Key="IsNullOrEmptyConverter"/> |
| 52 | + </StackLayout.Resources> |
| 53 | + |
| 54 | + <StackLayout.Style> |
| 55 | + <Style TargetType="{x:Type StackLayout}"> |
| 56 | + <Setter Property="BindableLayout.ItemTemplate"> |
| 57 | + <Setter.Value> |
| 58 | + <DataTemplate x:DataType="{x:Type Interfaces:IEvent}"> |
| 59 | + <Rectangle |
| 60 | + Fill="{Binding Color}" |
| 61 | + HeightRequest="{Binding EventHeightRequest, Source={x:Reference DayView_Unique}}" |
| 62 | + HorizontalOptions="CenterAndExpand" |
| 63 | + RadiusX="{Binding EventCornerRadius, Source={x:Reference DayView_Unique}}" |
| 64 | + RadiusY="{Binding EventCornerRadius, Source={x:Reference DayView_Unique}}" |
| 65 | + VerticalOptions="Center" |
| 66 | + WidthRequest="{Binding EventWidthRequest, Source={x:Reference DayView_Unique}}"/> |
| 67 | + </DataTemplate> |
| 68 | + </Setter.Value> |
| 69 | + </Setter> |
| 70 | + |
| 71 | + <Style.Triggers> |
| 72 | + <DataTrigger |
| 73 | + Binding="{Binding EventTemplate, Source={x:Reference DayView_Unique}, Converter={StaticResource IsNullOrEmptyConverter}}" |
| 74 | + TargetType="{x:Type StackLayout}" |
| 75 | + Value="{StaticResource FalseValue}"> |
| 76 | + <Setter Property="BindableLayout.ItemTemplate" Value="{Binding EventTemplate, Source={x:Reference DayView_Unique}}"/> |
| 77 | + </DataTrigger> |
| 78 | + |
| 79 | + <DataTrigger |
| 80 | + Binding="{Binding IsCurrentMonth, Source={x:Reference DayView_Unique}}" |
| 81 | + TargetType="{x:Type StackLayout}" |
| 82 | + Value="{StaticResource FalseValue}"> |
| 83 | + <Setter Property="IsVisible" Value="False"/> |
| 84 | + </DataTrigger> |
| 85 | + |
| 86 | + <DataTrigger |
| 87 | + Binding="{Binding IsInvalid, Source={x:Reference DayView_Unique}}" |
| 88 | + TargetType="{x:Type StackLayout}" |
| 89 | + Value="{StaticResource TrueValue}"> |
| 90 | + <Setter Property="IsVisible" Value="False"/> |
| 91 | + </DataTrigger> |
| 92 | + </Style.Triggers> |
| 93 | + </Style> |
| 94 | + </StackLayout.Style> |
| 95 | + </StackLayout> |
| 96 | + </ContentView> |
| 97 | + |
| 98 | + </Grid> |
26 | 99 |
|
27 | 100 | <ContentView.GestureRecognizers>
|
28 | 101 | <TapGestureRecognizer Command="{Binding Command, Source={x:Reference DayView_Unique}}" CommandParameter="{Binding CommandParameter, Source={x:Reference DayView_Unique}}"/>
|
|
0 commit comments