misc: update timelineitem style

This commit is contained in:
rabbitism
2023-03-23 23:25:29 +08:00
parent 2b183027b1
commit 2a38bb09a2
3 changed files with 10 additions and 77 deletions

View File

@@ -23,15 +23,6 @@ public class TimelineItem: ContentControl
set => SetValue(IconForegroundProperty, value);
}
public static readonly StyledProperty<object?> DescriptionProperty =
AvaloniaProperty.Register<TimelineItem, object?>(nameof(Description));
public object? Description
{
get => GetValue(DescriptionProperty);
set => SetValue(DescriptionProperty, value);
}
public static readonly StyledProperty<DateTime> TimeProperty = AvaloniaProperty.Register<TimelineItem, DateTime>(
nameof(Time));
public DateTime Time
@@ -41,7 +32,7 @@ public class TimelineItem: ContentControl
}
public static readonly StyledProperty<string?> TimeFormatProperty = AvaloniaProperty.Register<TimelineItem, string?>(
nameof(TimeFormat), defaultValue:CultureInfo.CurrentUICulture.DateTimeFormat.SortableDateTimePattern);
nameof(TimeFormat), defaultValue:CultureInfo.CurrentUICulture.DateTimeFormat.ShortDatePattern);
public string? TimeFormat
{
@@ -63,53 +54,4 @@ public class TimelineItem: ContentControl
PseudoClasses.Set(PC_First, isFirst);
PseudoClasses.Set(PC_Last, isLast);
}
}
public class TimelineItemLayoutProperties: AvaloniaObject
{
private double _dimensionDelta = 0.01;
public static readonly StyledProperty<double> TimeSlotWidthProperty = AvaloniaProperty.Register<TimelineItemLayoutProperties, double>(
nameof(TimeSlotWidth));
public double TimeSlotWidth
{
get => GetValue(TimeSlotWidthProperty);
set
{
if (Math.Abs(GetValue(TimeSlotWidthProperty) - value) < _dimensionDelta) return;
SetValue(TimeSlotWidthProperty, value);
}
}
public static readonly StyledProperty<double> TimeSlotHeightProperty = AvaloniaProperty.Register<TimelineItemLayoutProperties, double>(
nameof(TimeSlotHeight));
public double TimeSlotHeight
{
get => GetValue(TimeSlotHeightProperty);
set
{
if (Math.Abs(GetValue(TimeSlotHeightProperty) - value) < _dimensionDelta) return;
SetValue(TimeSlotHeightProperty, value);
}
}
public static readonly StyledProperty<double> ContentSlotWidthProperty = AvaloniaProperty.Register<TimelineItemLayoutProperties, double>(
nameof(ContentSlotWidth));
public double ContentSlotWidth
{
get => GetValue(ContentSlotWidthProperty);
set => SetValue(ContentSlotWidthProperty, value);
}
public static readonly StyledProperty<double> ContentSlotHeightProperty = AvaloniaProperty.Register<TimelineItemLayoutProperties, double>(
nameof(ContentSlotHeight));
public double ContentSlotHeight
{
get => GetValue(ContentSlotHeightProperty);
set => SetValue(ContentSlotHeightProperty, value);
}
}