From a7b9bd2876c067ad8b80a87cf54e8c4ac311b7dc Mon Sep 17 00:00:00 2001 From: amwx Date: Fri, 12 Jun 2020 17:11:38 -0500 Subject: [PATCH] Add styles and control catalog page --- samples/ControlCatalog/MainView.xaml | 3 + .../Pages/DateTimePickerPage.xaml | 123 ++++++++ .../Pages/DateTimePickerPage.xaml.cs | 30 ++ .../Accents/FluentControlResourcesDark.xaml | 64 ++++ .../Accents/FluentControlResourcesLight.xaml | 64 ++++ src/Avalonia.Themes.Fluent/DatePicker.xaml | 277 ++++++++++++++++++ src/Avalonia.Themes.Fluent/FluentTheme.xaml | 3 + .../LoopingSelector.xaml | 92 ++++++ src/Avalonia.Themes.Fluent/TimePicker.xaml | 235 +++++++++++++++ 9 files changed, 891 insertions(+) create mode 100644 samples/ControlCatalog/Pages/DateTimePickerPage.xaml create mode 100644 samples/ControlCatalog/Pages/DateTimePickerPage.xaml.cs create mode 100644 src/Avalonia.Themes.Fluent/DatePicker.xaml create mode 100644 src/Avalonia.Themes.Fluent/LoopingSelector.xaml create mode 100644 src/Avalonia.Themes.Fluent/TimePicker.xaml diff --git a/samples/ControlCatalog/MainView.xaml b/samples/ControlCatalog/MainView.xaml index af2d093bc7..e0ebcbb15b 100644 --- a/samples/ControlCatalog/MainView.xaml +++ b/samples/ControlCatalog/MainView.xaml @@ -29,6 +29,9 @@ ScrollViewer.HorizontalScrollBarVisibility="Disabled"> + + + diff --git a/samples/ControlCatalog/Pages/DateTimePickerPage.xaml b/samples/ControlCatalog/Pages/DateTimePickerPage.xaml new file mode 100644 index 0000000000..e2d14167e5 --- /dev/null +++ b/samples/ControlCatalog/Pages/DateTimePickerPage.xaml @@ -0,0 +1,123 @@ + + + DatePicker and TimePicker + + + + + A simple DatePicker with a header + + + + + + + + + <DatePicker Header="Pick a date" /> + + + + + + + A DatePicker with day formatted and year hidden. + + + + + + + + + <DatePicker DayFormat="{}{day.integer} ({dayofweek.abbreviated})" YearVisible="False" /> + + + + + + + + + A simple TimePicker. + + + + + + + + + <TimePicker /> + + + + + + + A TimePicker with a header and minute increments specified. + + + + + + + + + <TimePicker Header="Arrival time" MinuteIncrement="15" /> + + + + + + + A TimePicker using a 12-hour clock. + + + + + + + + + <TimePicker ClockIdentifier="12HourClock" Header="12 hour clock" /> + + + + + + + A TimePicker using a 24-hour clock. + + + + + + + + + <TimePicker ClockIdentifier="24HourClock" Header="24 hour clock" /> + + + + + + + + + diff --git a/samples/ControlCatalog/Pages/DateTimePickerPage.xaml.cs b/samples/ControlCatalog/Pages/DateTimePickerPage.xaml.cs new file mode 100644 index 0000000000..6c7ae3437e --- /dev/null +++ b/samples/ControlCatalog/Pages/DateTimePickerPage.xaml.cs @@ -0,0 +1,30 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Markup.Xaml; + +namespace ControlCatalog.Pages +{ + public class DateTimePickerPage : UserControl + { + public DateTimePickerPage() + { + this.InitializeComponent(); + this.FindControl("DatePickerDesc").Text = "Use a DatePicker to let users set a date in your app, " + + "for example to schedule an appointment. The DatePicker displays three controls for month, day, and year. " + + "These controls are easy to use with touch or mouse, and they can be styled and configured in several different ways. " + + "Order of month, day, and year is dynamically set based on user date settings"; + + this.FindControl("TimePickerDesc").Text = "Use a TimePicker to let users set a time in your app, for example " + + "to set a reminder. The TimePicker displays three controls for hour, minute, and AM / PM(if necessary).These controls " + + "are easy to use with touch or mouse, and they can be styled and configured in several different ways. " + + "12 - hour or 24 - hour clock and visiblility of AM / PM is dynamically set based on user time settings, or can be overridden."; + + + } + + private void InitializeComponent() + { + AvaloniaXamlLoader.Load(this); + } + } +} diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml index eb6cc610cc..3851c52713 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml @@ -657,5 +657,69 @@ 8,5,8,7 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml index cba20faf7c..1a37bb6c21 100644 --- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml +++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml @@ -655,5 +655,69 @@ 8,5,8,7 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent/DatePicker.xaml b/src/Avalonia.Themes.Fluent/DatePicker.xaml new file mode 100644 index 0000000000..0d6d1ba9f1 --- /dev/null +++ b/src/Avalonia.Themes.Fluent/DatePicker.xaml @@ -0,0 +1,277 @@ + + + + + 0,0,0,4 + 40 + 40 + 41 + 296 + 456 + 0,3,0,6 + 9,3,0,6 + 0,3,0,6 + 9,3,0,6 + + + 80 + 1 + 20 + 20 + 0,0,0,4 + Normal + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent/FluentTheme.xaml b/src/Avalonia.Themes.Fluent/FluentTheme.xaml index 49b2d9561b..4faed21f4d 100644 --- a/src/Avalonia.Themes.Fluent/FluentTheme.xaml +++ b/src/Avalonia.Themes.Fluent/FluentTheme.xaml @@ -53,4 +53,7 @@ + + + diff --git a/src/Avalonia.Themes.Fluent/LoopingSelector.xaml b/src/Avalonia.Themes.Fluent/LoopingSelector.xaml new file mode 100644 index 0000000000..a279f0aaae --- /dev/null +++ b/src/Avalonia.Themes.Fluent/LoopingSelector.xaml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + diff --git a/src/Avalonia.Themes.Fluent/TimePicker.xaml b/src/Avalonia.Themes.Fluent/TimePicker.xaml new file mode 100644 index 0000000000..65b94ef540 --- /dev/null +++ b/src/Avalonia.Themes.Fluent/TimePicker.xaml @@ -0,0 +1,235 @@ + + + + + 0,0,0,4 + 40 + 41 + 242 + 456 + 40 + 0,3,0,6 + 0,3,0,6 + + + 80 + 1 + 1 + 0,0,0,4 + 0,0,20,0 + 20,0,0,0 + Normal + + + + + + + + + + + + + + + + + + + + + + + + + + +