Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DatePicker and TimePicker controls #4108

Merged
merged 40 commits into from
Jun 30, 2020
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
6b1f627
Add DateTimeFormatter class
amwx Jun 12, 2020
427e1f6
Add LoopingSelector control
amwx Jun 12, 2020
e7d6a2a
Add DatePicker and related classes
amwx Jun 12, 2020
e641743
Add TimePicker and update DatePicker
amwx Jun 12, 2020
a7b9bd2
Add styles and control catalog page
amwx Jun 12, 2020
c4882d2
Control fixes
amwx Jun 13, 2020
c1315f0
Redo looping selectors to properly scroll
amwx Jun 14, 2020
c70c09e
Fix LoopingSelector button background
amwx Jun 14, 2020
6352a12
Adjust popup placement
amwx Jun 14, 2020
afbf417
Fix DateTimeFormatter 12HourClock hour
amwx Jun 14, 2020
3c3853d
Remove DateTimeFormatter/use normal .net formatting
amwx Jun 16, 2020
8e18819
Remove linq usage from LoopingSelector
amwx Jun 16, 2020
ce7a569
Fix popup positioning
amwx Jun 16, 2020
219a281
Merge branch 'master' into master
danwalmsley Jun 16, 2020
e1ba96b
Add some unit tests
amwx Jun 17, 2020
8fd25b6
Merge branch 'master' of https://github.com/amwx/Avalonia
amwx Jun 17, 2020
dbc982e
Merge branch 'master' into master
danwalmsley Jun 17, 2020
b16b944
Merge branch 'master' into master
danwalmsley Jun 17, 2020
af2d320
Rename timepicker selectedtime test
amwx Jun 18, 2020
b8b9824
Merge remote-tracking branch 'origin/master' into amwx-calendar
danwalmsley Jun 18, 2020
88a4e10
DatePickerPresenter, use simplified method for SetGrid.
danwalmsley Jun 19, 2020
27d08f4
use pressed mixing to simplify loopingselector item.
danwalmsley Jun 19, 2020
994c494
Merge branch 'master' of https://github.com/AvaloniaUI/Avalonia
amwx Jun 23, 2020
54a4f45
Revert and prep for new impl
amwx Jun 23, 2020
ddbf23f
Add DateTimePickerPanel
amwx Jun 23, 2020
6d412d5
New DatePicker/DatePickerPresenter
amwx Jun 23, 2020
deff41b
New TimePicker/TimePickerPresenter
amwx Jun 23, 2020
65f449b
Update styles
amwx Jun 23, 2020
7435e8b
Clean up a few things
amwx Jun 23, 2020
4d91c24
Fix popup staysopen
amwx Jun 23, 2020
41d7289
Use nameof in properties
amwx Jun 23, 2020
6c8a180
Merge branch 'master' into master
jmacato Jun 24, 2020
bcf1f3a
Merge branch 'master' into master
danwalmsley Jun 24, 2020
b00f716
Merge branch 'master' into master
jmacato Jun 25, 2020
445caf5
Update src/Avalonia.Controls/DateTimePickers/DateTimePickerPanel.cs
amwx Jun 25, 2020
9e179c2
Merge branch 'master' into master
amwx Jun 26, 2020
1d479dc
Merge branch 'master' into master
danwalmsley Jun 29, 2020
692a2c4
Merge branch 'master' into master
danwalmsley Jun 30, 2020
c9a4543
Skip failing time picker test
amwx Jun 30, 2020
13b453e
Merge remote-tracking branch 'origin/master' into amwx-calendar
danwalmsley Jun 30, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions samples/ControlCatalog/MainView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<pages:DataGridPage/>
</TabItem>
<TabItem Header="Date/Time Picker">
<pages:DateTimePickerPage/>
</TabItem>
<TabItem Header="CalendarDatePicker">
<pages:CalendarDatePickerPage/></TabItem>
<TabItem Header="Drag+Drop"><pages:DragAndDropPage/></TabItem>
Expand Down
123 changes: 123 additions & 0 deletions samples/ControlCatalog/Pages/DateTimePickerPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="ControlCatalog.Pages.DateTimePickerPage">
<StackPanel Orientation="Vertical" Spacing="4" HorizontalAlignment="Stretch">
<TextBlock Classes="h1">DatePicker and TimePicker</TextBlock>
<TextBlock Name="DatePickerDesc" Classes="h2" TextWrapping="Wrap"/>
<TextBlock Name="TimePickerDesc" Classes="h2" TextWrapping="Wrap"/>

<StackPanel Orientation="Vertical"
Margin="16"
HorizontalAlignment="Stretch"
Spacing="16">
<TextBlock FontSize="18">A simple DatePicker with a header</TextBlock>
<StackPanel Orientation="Vertical">
<Border BorderBrush="{DynamicResource SystemControlHighlightBaseLowBrush}"
BorderThickness="1" Padding="15">
<DatePicker Header="Pick a date" />
</Border>
<Panel Background="{DynamicResource SystemControlBackgroundBaseLowBrush}">
<TextBlock Padding="15">
<TextBlock.Text>
<x:String>
&lt;DatePicker Header="Pick a date" /&gt;
</x:String>
</TextBlock.Text>
</TextBlock>
</Panel>
</StackPanel>

<TextBlock FontSize="18">A DatePicker with day formatted and year hidden.</TextBlock>
<StackPanel Orientation="Vertical">
<Border BorderBrush="{DynamicResource SystemControlHighlightBaseLowBrush}"
BorderThickness="1" Padding="15">
<DatePicker x:Name="Control2" DayFormat="d (ddd)"
YearVisible="False" />
</Border>
<Panel Background="{DynamicResource SystemControlBackgroundBaseLowBrush}">
<TextBlock Padding="15">
<TextBlock.Text>
<x:String>
&lt;DatePicker DayFormat="d (ddd)" YearVisible="False" /&gt;
</x:String>
</TextBlock.Text>
</TextBlock>
</Panel>
</StackPanel>

<Border Background="{DynamicResource SystemControlHighlightBaseLowBrush}" BorderThickness="1" Margin="15" />

<TextBlock FontSize="18">A simple TimePicker.</TextBlock>
<StackPanel Orientation="Vertical">
<Border BorderBrush="{DynamicResource SystemControlHighlightBaseLowBrush}"
BorderThickness="1" Padding="15">
<TimePicker />
</Border>
<Panel Background="{DynamicResource SystemControlBackgroundBaseLowBrush}">
<TextBlock Padding="15">
<TextBlock.Text>
<x:String>
&lt;TimePicker /&gt;
</x:String>
</TextBlock.Text>
</TextBlock>
</Panel>
</StackPanel>

<TextBlock FontSize="18">A TimePicker with a header and minute increments specified.</TextBlock>
<StackPanel Orientation="Vertical">
<Border BorderBrush="{DynamicResource SystemControlHighlightBaseLowBrush}"
BorderThickness="1" Padding="15">
<TimePicker Header="Arrival time" MinuteIncrement="15" />
</Border>
<Panel Background="{DynamicResource SystemControlBackgroundBaseLowBrush}">
<TextBlock Padding="15">
<TextBlock.Text>
<x:String>
&lt;TimePicker Header="Arrival time" MinuteIncrement="15" /&gt;
</x:String>
</TextBlock.Text>
</TextBlock>
</Panel>
</StackPanel>

<TextBlock FontSize="18">A TimePicker using a 12-hour clock.</TextBlock>
<StackPanel Orientation="Vertical">
<Border BorderBrush="{DynamicResource SystemControlHighlightBaseLowBrush}"
BorderThickness="1" Padding="15">
<TimePicker ClockIdentifier="12HourClock" Header="12 hour clock" />
</Border>
<Panel Background="{DynamicResource SystemControlBackgroundBaseLowBrush}">
<TextBlock Padding="15">
<TextBlock.Text>
<x:String>
&lt;TimePicker ClockIdentifier="12HourClock" Header="12 hour clock" /&gt;
</x:String>
</TextBlock.Text>
</TextBlock>
</Panel>
</StackPanel>

<TextBlock FontSize="18">A TimePicker using a 24-hour clock.</TextBlock>
<StackPanel Orientation="Vertical">
<Border BorderBrush="{DynamicResource SystemControlHighlightBaseLowBrush}"
BorderThickness="1" Padding="15">
<TimePicker ClockIdentifier="24HourClock" Header="24 hour clock" />
</Border>
<Panel Background="{DynamicResource SystemControlBackgroundBaseLowBrush}">
<TextBlock Padding="15">
<TextBlock.Text>
<x:String>
&lt;TimePicker ClockIdentifier="24HourClock" Header="24 hour clock" /&gt;
</x:String>
</TextBlock.Text>
</TextBlock>
</Panel>
</StackPanel>

</StackPanel>
</StackPanel>
</UserControl>
30 changes: 30 additions & 0 deletions samples/ControlCatalog/Pages/DateTimePickerPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -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<TextBlock>("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<TextBlock>("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);
}
}
}
Loading