|
|
@@ -16,13 +16,6 @@ using System.Runtime.Serialization;
|
|
|
|
|
|
namespace InABox.Avalonia.Components;
|
|
|
|
|
|
-public class CalendarEmptyBlockEventArgs(object column, TimeSpan start, TimeSpan end) : EventArgs
|
|
|
-{
|
|
|
- public object Column { get; set; } = column;
|
|
|
- public TimeSpan Start { get; set; } = start;
|
|
|
- public TimeSpan End { get; set; } = end;
|
|
|
-}
|
|
|
-
|
|
|
public class CalendarBlockEventArgs(object? value, object column, TimeSpan start, TimeSpan end) : EventArgs
|
|
|
{
|
|
|
public object? Value { get; set; } = value;
|
|
|
@@ -63,6 +56,9 @@ public partial class CalendarView : UserControl
|
|
|
public static readonly StyledProperty<IEnumerable?> ColumnsProperty =
|
|
|
AvaloniaProperty.Register<CalendarView, IEnumerable?>(nameof(Columns));
|
|
|
|
|
|
+ public static readonly StyledProperty<bool> ShowColumnsProperty =
|
|
|
+ AvaloniaProperty.Register<CalendarView, bool>(nameof(ShowColumns));
|
|
|
+
|
|
|
public double MinimumColumnWidth
|
|
|
{
|
|
|
get => GetValue(MinimumColumnWidthProperty);
|
|
|
@@ -130,8 +126,11 @@ public partial class CalendarView : UserControl
|
|
|
set => SetValue(ColumnsProperty, value);
|
|
|
}
|
|
|
|
|
|
- public event EventHandler<CalendarEmptyBlockEventArgs>? EmptyBlockClicked;
|
|
|
- public event EventHandler<CalendarEmptyBlockEventArgs>? EmptyBlockHeld;
|
|
|
+ public bool ShowColumns
|
|
|
+ {
|
|
|
+ get => GetValue(ShowColumnsProperty);
|
|
|
+ set => SetValue(ShowColumnsProperty, value);
|
|
|
+ }
|
|
|
|
|
|
public event EventHandler<CalendarBlockEventArgs>? BlockClicked;
|
|
|
public event EventHandler<CalendarBlockEventArgs>? BlockHeld;
|
|
|
@@ -538,13 +537,13 @@ public partial class CalendarView : UserControl
|
|
|
private void Canvas_PointerPressed(object? sender, PointerPressedEventArgs e)
|
|
|
{
|
|
|
if (!TryGetBlockFromPosition(e, out var column, out var start, out var end)) return;
|
|
|
- PressedAction(() => EmptyBlockHeld?.Invoke(this, new(column, start, end)));
|
|
|
+ PressedAction(() => BlockHeld?.Invoke(this, new(null, column, start, end)));
|
|
|
}
|
|
|
|
|
|
private void Canvas_PointerReleased(object? sender, PointerReleasedEventArgs e)
|
|
|
{
|
|
|
if (!TryGetBlockFromPosition(e, out var column, out var start, out var end)) return;
|
|
|
- ReleasedAction(() => EmptyBlockClicked?.Invoke(this, new(column, start, end)));
|
|
|
+ ReleasedAction(() => BlockClicked?.Invoke(this, new(null, column, start, end)));
|
|
|
}
|
|
|
|
|
|
private void ContentControl_SizeChanged(object? sender, SizeChangedEventArgs e)
|