-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply some fixes and return back Calendar styles, migrate DatePicker …
- Loading branch information
Showing
4 changed files
with
102 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<ResourceDictionary xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:assists="clr-namespace:Material.Styles.Assists" | ||
xmlns:naming="clr-namespace:Material.Styles.Resources.Naming" | ||
xmlns:converters="clr-namespace:Material.Styles.Converters" | ||
xmlns:controls="clr-namespace:Material.Styles.Controls"> | ||
<Design.PreviewWith> | ||
<StackPanel Margin="20 20 200 1000"> | ||
<DatePicker /> | ||
</StackPanel> | ||
</Design.PreviewWith> | ||
|
||
<ControlTheme x:Key="MaterialDatePicker" TargetType="DatePicker"> | ||
<Setter Property="Background" Value="Transparent" /> | ||
<Setter Property="BorderBrush" Value="Transparent" /> | ||
<Setter Property="BorderThickness" Value="0" /> | ||
<Setter Property="Padding" Value="0" /> | ||
<Setter Property="assists:TextFieldAssist.Label" Value="Date" /> | ||
|
||
<Setter Property="MonthFormat" Value="MMMM" /> | ||
<Setter Property="DayFormat" Value=" dd" /> | ||
<Setter Property="YearFormat" Value=", yyyy" /> | ||
<Setter Property="assists:DatePickerAssist.DateTimeFormat" Value="dd MMMM yyyy" /> | ||
|
||
<Setter Property="Template"> | ||
<ControlTemplate> | ||
<Panel> | ||
<!-- This controls required by avalonia code behind --> | ||
<TextBlock IsVisible="False" IsTabStop="False" Height="0" Width="0" Name="{x:Static naming:PartNames.AvaloniaDayText}" /> | ||
<TextBlock IsVisible="False" IsTabStop="False" Height="0" Width="0" Name="{x:Static naming:PartNames.AvaloniaMonthText}" /> | ||
<TextBlock IsVisible="False" IsTabStop="False" Height="0" Width="0" Name="{x:Static naming:PartNames.AvaloniaYearText}" /> | ||
|
||
<!-- TODO: Make TextBox writeable --> | ||
<!-- TODO: allow use different text boxes style--> | ||
<TextBox Name="DisplayTextBox" | ||
assists:TextFieldAssist.Label="{TemplateBinding assists:TextFieldAssist.Label}"> | ||
<TextBox.Text> | ||
<MultiBinding Converter="{x:Static converters:DatePickerTextConverter.Instance}"> | ||
<TemplateBinding Property="SelectedDate" /> | ||
<TemplateBinding Property="assists:DatePickerAssist.DateTimeFormat" /> | ||
</MultiBinding> | ||
</TextBox.Text> | ||
<TextBox.InnerRightContent> | ||
<ToggleButton Name="CalendarButton" | ||
Classes="Icon" | ||
Width="36" | ||
Height="36" | ||
Margin="8 8 8 6"> | ||
<controls:MaterialInternalIcon Kind="Calendar" | ||
Width="20" | ||
Height="20" /> | ||
</ToggleButton> | ||
</TextBox.InnerRightContent> | ||
</TextBox> | ||
<Panel Name="PART_PopupContainer"> | ||
<Popup Name="PART_CalendarPopup" | ||
IsOpen="{Binding #CalendarButton.IsChecked, Mode=TwoWay}"> | ||
<controls:Card Name="{x:Static naming:PartNames.PartCard}"> | ||
<Calendar | ||
SelectedDate="{TemplateBinding SelectedDate, | ||
Mode=TwoWay, Converter={x:Static converters:DateTimeOffsetConverter.Instance}}" /> | ||
</controls:Card> | ||
</Popup> | ||
</Panel> | ||
</Panel> | ||
</ControlTemplate> | ||
</Setter> | ||
|
||
<Style Selector="^ /template/ Panel#PART_PopupContainer"> | ||
<Setter Property="Margin" Value="-8" /> | ||
</Style> | ||
|
||
<Style Selector="^ /template/ Popup#PART_CalendarPopup"> | ||
<Setter Property="VerticalOffset" Value="-16" /> | ||
<Setter Property="IsLightDismissEnabled" Value="True" /> | ||
</Style> | ||
|
||
<Style Selector="^ /template/ Popup#PART_CalendarPopup > controls|Card#PART_Card"> | ||
<Setter Property="Padding" Value="0" /> | ||
<Setter Property="Margin" Value="8" /> | ||
</Style> | ||
|
||
<Style Selector="^ /template/ TextBox#DisplayTextBox"> | ||
<Setter Property="Margin" Value="0" /> | ||
<Setter Property="IsReadOnly" Value="True" /> | ||
<Setter Property="UseFloatingWatermark" Value="True" /> | ||
</Style> | ||
|
||
<Style Selector="^.multiselect /template/ Popup#PART_CalendarPopup Calendar"> | ||
<Setter Property="SelectionMode" Value="MultipleRange" /> | ||
</Style> | ||
</ControlTheme> | ||
|
||
<!-- Default theme --> | ||
<ControlTheme x:Key="{x:Type DatePicker}" TargetType="DatePicker" | ||
BasedOn="{StaticResource MaterialDatePicker}" /> | ||
</ResourceDictionary> |