feat: start/end effect.
This commit is contained in:
@@ -83,6 +83,9 @@ public class Timeline: ItemsControl
|
||||
base.PrepareContainerForItemOverride(container, item, index);
|
||||
if (container is TimelineItem t)
|
||||
{
|
||||
bool start = index == 0;
|
||||
bool end = index == ItemCount - 1;
|
||||
t.SetEnd(start, end);
|
||||
if (IconMemberBinding != null)
|
||||
{
|
||||
t.Bind(TimelineItem.IconProperty, IconMemberBinding);
|
||||
|
||||
@@ -8,6 +8,7 @@ using Avalonia.Media;
|
||||
|
||||
namespace Ursa.Controls;
|
||||
|
||||
[PseudoClasses(":first", ":last")]
|
||||
public class TimelineItem: HeaderedContentControl
|
||||
{
|
||||
public static readonly StyledProperty<object?> IconProperty = AvaloniaProperty.Register<TimelineItem, object?>(
|
||||
@@ -36,6 +37,10 @@ public class TimelineItem: HeaderedContentControl
|
||||
get => GetValue(TypeProperty);
|
||||
set => SetValue(TypeProperty, value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
internal void SetEnd(bool start, bool end)
|
||||
{
|
||||
PseudoClasses.Set(":first", start);
|
||||
PseudoClasses.Set(":last", end);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user