Merge pull request #265 from irihitech/calendar
CalendarView and DatePicker and DateRangePicker
This commit is contained in:
14
demo/Ursa.Demo/Pages/DatePickerDemo.axaml
Normal file
14
demo/Ursa.Demo/Pages/DatePickerDemo.axaml
Normal file
@@ -0,0 +1,14 @@
|
||||
<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"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Ursa.Demo.Pages.DatePickerDemo">
|
||||
<StackPanel Margin="20" HorizontalAlignment="Left">
|
||||
<u:CalendarView DateSelected="CalendarView_OnOnDateSelected" DatePreviewed="CalendarView_OnOnDatePreviewed"/>
|
||||
<TextBlock Text="{Binding #singlePicker.SelectedDate}" ></TextBlock>
|
||||
<u:DatePicker Name="singlePicker" Width="200" />
|
||||
<u:DateRangePicker Width="300" DisplayFormat="yyyyMMdd" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
25
demo/Ursa.Demo/Pages/DatePickerDemo.axaml.cs
Normal file
25
demo/Ursa.Demo/Pages/DatePickerDemo.axaml.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System.Diagnostics;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Ursa.Controls;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
public partial class DatePickerDemo : UserControl
|
||||
{
|
||||
public DatePickerDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void CalendarView_OnOnDateSelected(object? sender, CalendarDayButtonEventArgs e)
|
||||
{
|
||||
Debug.WriteLine("Pressed: "+ e.Date?.ToLongDateString());
|
||||
}
|
||||
|
||||
private void CalendarView_OnOnDatePreviewed(object? sender, CalendarDayButtonEventArgs e)
|
||||
{
|
||||
Debug.WriteLine("Hovered: "+e.Date?.ToLongDateString());
|
||||
}
|
||||
}
|
||||
6
demo/Ursa.Demo/ViewModels/DatePickerDemoViewModel.cs
Normal file
6
demo/Ursa.Demo/ViewModels/DatePickerDemoViewModel.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Ursa.Demo.ViewModels;
|
||||
|
||||
public class DatePickerDemoViewModel
|
||||
{
|
||||
|
||||
}
|
||||
@@ -31,6 +31,7 @@ public class MainViewViewModel : ViewModelBase
|
||||
MenuKeys.MenuKeyBreadcrumb => new BreadcrumbDemoViewModel(),
|
||||
MenuKeys.MenuKeyClassInput => new ClassInputDemoViewModel(),
|
||||
MenuKeys.MenuKeyClock => new ClockDemoViewModel(),
|
||||
MenuKeys.MenuKeyDatePicker => new DatePickerDemoViewModel(),
|
||||
MenuKeys.MenuKeyDialog => new DialogDemoViewModel(),
|
||||
MenuKeys.MenuKeyDivider => new DividerDemoViewModel(),
|
||||
MenuKeys.MenuKeyDisableContainer => new DisableContainerDemoViewModel(),
|
||||
|
||||
@@ -18,6 +18,7 @@ public class MenuViewModel: ViewModelBase
|
||||
new() { MenuHeader = "Button Group", Key = MenuKeys.MenuKeyButtonGroup },
|
||||
new() { MenuHeader = "Class Input", Key = MenuKeys.MenuKeyClassInput },
|
||||
new() { MenuHeader = "Clock", Key = MenuKeys.MenuKeyClock, Status = "New" },
|
||||
new() { MenuHeader = "Date Picker", Key = MenuKeys.MenuKeyDatePicker },
|
||||
new() { MenuHeader = "Dialog", Key = MenuKeys.MenuKeyDialog },
|
||||
new() { MenuHeader = "Disable Container", Key = MenuKeys.MenuKeyDisableContainer },
|
||||
new() { MenuHeader = "Divider", Key = MenuKeys.MenuKeyDivider },
|
||||
@@ -65,6 +66,7 @@ public static class MenuKeys
|
||||
public const string MenuKeyBreadcrumb= "Breadcrumb";
|
||||
public const string MenuKeyClassInput = "Class Input";
|
||||
public const string MenuKeyClock = "Clock";
|
||||
public const string MenuKeyDatePicker = "DatePicker";
|
||||
public const string MenuKeyDialog = "Dialog";
|
||||
public const string MenuKeyDivider = "Divider";
|
||||
public const string MenuKeyDisableContainer = "DisableContainer";
|
||||
|
||||
Reference in New Issue
Block a user