-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #580 from irihitech/commitinput
Update Date and Time pickers for better text input experience.
- Loading branch information
Showing
21 changed files
with
549 additions
and
167 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,28 @@ | ||
<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" | ||
xmlns:u="https://irihi.tech/ursa" | ||
xmlns:viewModels="clr-namespace:Ursa.Demo.ViewModels" | ||
x:DataType="viewModels:DatePickerDemoViewModel" | ||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" | ||
x:Class="Ursa.Demo.Pages.DatePickerDemo"> | ||
<UserControl | ||
x:Class="Ursa.Demo.Pages.DatePickerDemo" | ||
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" | ||
xmlns:u="https://irihi.tech/ursa" | ||
xmlns:viewModels="clr-namespace:Ursa.Demo.ViewModels" | ||
d:DesignHeight="450" | ||
d:DesignWidth="800" | ||
x:DataType="viewModels:DatePickerDemoViewModel" | ||
mc:Ignorable="d"> | ||
<StackPanel Margin="20" HorizontalAlignment="Left"> | ||
<u:Form> | ||
<u:DatePicker Width="200" u:FormItem.Label="_Test"/> | ||
<TextBox Width="200" u:FormItem.Label="_West"/> | ||
</u:Form> | ||
<u:CalendarView DateSelected="CalendarView_OnOnDateSelected" DatePreviewed="CalendarView_OnOnDatePreviewed"/> | ||
<TextBlock Text="{Binding #singlePicker.SelectedDate}" ></TextBlock> | ||
<u:DatePicker Name="singlePicker" Width="200" Classes="ClearButton" /> | ||
<u:DateRangePicker Width="300" DisplayFormat="yyyyMMdd" Classes="ClearButton" /> | ||
|
||
<TextBlock Text="Binding"></TextBlock> | ||
<u:DatePicker Width="200" SelectedDate="{Binding SelectedDate, Mode=TwoWay}"/> | ||
<u:DateRangePicker Width="300" SelectedStartDate="{Binding StartDate}" SelectedEndDate="{Binding EndDate}"/> | ||
<TextBox Name="format" InnerLeftContent="Display Format" Text="yyyy-MM-dd" /> | ||
<TextBlock Text="Default" /> | ||
<u:DatePicker Width="200" DisplayFormat="{Binding #format.Text}" /> | ||
<TextBlock Text="Binding" /> | ||
<u:DatePicker | ||
Width="200" | ||
DisplayFormat="{Binding #format.Text}" | ||
SelectedDate="{Binding SelectedDate, Mode=TwoWay}" /> | ||
<TextBlock Text="Clear Button" /> | ||
<u:DatePicker | ||
Name="singlePicker" | ||
Width="200" | ||
Classes="ClearButton" /> | ||
</StackPanel> | ||
</UserControl> | ||
</UserControl> |
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,37 @@ | ||
<UserControl | ||
x:Class="Ursa.Demo.Pages.DateRangePickerDemo" | ||
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" | ||
xmlns:u="https://irihi.tech/ursa" | ||
xmlns:viewModels="clr-namespace:Ursa.Demo.ViewModels" | ||
d:DesignHeight="450" | ||
d:DesignWidth="800" | ||
x:DataType="viewModels:DateRangePickerDemoViewModel" | ||
mc:Ignorable="d"> | ||
<StackPanel HorizontalAlignment="Left"> | ||
<TextBox | ||
Name="format" | ||
Text="yyyy-MM-dd" | ||
Watermark="Display Format" /> | ||
<TextBlock Text="Default" /> | ||
<u:DateRangePicker | ||
Width="360" | ||
DisplayFormat="{Binding #format.Text}" | ||
SelectedEndDate="{Binding EndDate}" | ||
SelectedStartDate="{Binding StartDate}" /> | ||
|
||
<TextBlock Text="Clear Button" /> | ||
<u:DateRangePicker | ||
Width="360" | ||
Classes="ClearButton" | ||
DisplayFormat="{Binding #format.Text}" /> | ||
<TextBlock Text="Initialized with Binding" /> | ||
<u:DateRangePicker | ||
Width="360" | ||
DisplayFormat="{Binding #format.Text}" | ||
SelectedEndDate="{Binding EndDate}" | ||
SelectedStartDate="{Binding StartDate}" /> | ||
</StackPanel> | ||
</UserControl> |
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,13 @@ | ||
using Avalonia; | ||
using Avalonia.Controls; | ||
using Avalonia.Markup.Xaml; | ||
|
||
namespace Ursa.Demo.Pages; | ||
|
||
public partial class DateRangePickerDemo : UserControl | ||
{ | ||
public DateRangePickerDemo() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} |
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,44 @@ | ||
<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" | ||
xmlns:viewModels="clr-namespace:Ursa.Demo.ViewModels" | ||
xmlns:u="https://irihi.tech/ursa" | ||
mc:Ignorable="d" d:DesignWidth="800" | ||
d:DesignHeight="450" | ||
x:DataType="viewModels:TimeRangePickerDemoViewModel" | ||
x:Class="Ursa.Demo.Pages.TimeRangePickerDemo"> | ||
<StackPanel HorizontalAlignment="Left"> | ||
<TextBox | ||
Name="displayFormat" | ||
Width="300" | ||
InnerLeftContent="Display Format" | ||
Text="HH:mm:ss" /> | ||
<TextBox | ||
Name="panelFormat" | ||
Width="300" | ||
InnerLeftContent="Panel Format" | ||
Text="tt HH mm ss" /> | ||
|
||
<TextBlock Text="Default"/> | ||
<u:TimeRangePicker | ||
Width="300" | ||
DisplayFormat="{Binding #displayFormat.Text}" | ||
PanelFormat="{Binding #panelFormat.Text}" /> | ||
|
||
<TextBlock Text="Initialized by Binding"/> | ||
<u:TimeRangePicker | ||
Width="300" | ||
StartTime="{Binding StartTime}" | ||
EndTime="{Binding EndTime}" | ||
DisplayFormat="{Binding #displayFormat.Text}" | ||
PanelFormat="{Binding #panelFormat.Text}" /> | ||
|
||
<TextBlock Text="Clear Button"/> | ||
<u:TimeRangePicker | ||
Width="300" | ||
Classes="ClearButton" | ||
DisplayFormat="{Binding #displayFormat.Text}" | ||
PanelFormat="{Binding #panelFormat.Text}" /> | ||
</StackPanel> | ||
</UserControl> |
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,13 @@ | ||
using Avalonia; | ||
using Avalonia.Controls; | ||
using Avalonia.Markup.Xaml; | ||
|
||
namespace Ursa.Demo.Pages; | ||
|
||
public partial class TimeRangePickerDemo : UserControl | ||
{ | ||
public TimeRangePickerDemo() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} |
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,16 @@ | ||
using System; | ||
using CommunityToolkit.Mvvm.ComponentModel; | ||
|
||
namespace Ursa.Demo.ViewModels; | ||
|
||
public partial class DateRangePickerDemoViewModel: ObservableObject | ||
{ | ||
[ObservableProperty] private DateTime? _startDate; | ||
[ObservableProperty] private DateTime? _endDate; | ||
|
||
public DateRangePickerDemoViewModel() | ||
{ | ||
StartDate = DateTime.Today; | ||
EndDate = DateTime.Today.AddDays(7); | ||
} | ||
} |
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,16 @@ | ||
using System; | ||
using CommunityToolkit.Mvvm.ComponentModel; | ||
|
||
namespace Ursa.Demo.ViewModels; | ||
|
||
public partial class TimeRangePickerDemoViewModel: ObservableObject | ||
{ | ||
[ObservableProperty] private TimeSpan? _startTime; | ||
[ObservableProperty] private TimeSpan? _endTime; | ||
|
||
public TimeRangePickerDemoViewModel() | ||
{ | ||
StartTime = new TimeSpan(8, 21, 0); | ||
EndTime = new TimeSpan(18, 22, 0); | ||
} | ||
} |
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
Oops, something went wrong.