feat: swap placement.

This commit is contained in:
rabbitism
2024-01-08 23:19:10 +08:00
parent e1e04f7c8f
commit 22b5dafb8e
3 changed files with 29 additions and 23 deletions

View File

@@ -131,27 +131,6 @@
<Setter Property="Fill" Value="{DynamicResource SemiOrange6}"/> <Setter Property="Fill" Value="{DynamicResource SemiOrange6}"/>
</Style> </Style>
<Style Selector="^:all-left"> <Style Selector="^:all-left">
<Style Selector="^ /template/ ContentPresenter#PART_Header">
<Setter Property="Grid.Row" Value="0" />
<Setter Property="Grid.Column" Value="0" />
<Setter Property="HorizontalContentAlignment" Value="Right" />
<Setter Property="HorizontalAlignment" Value="Right" />
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_Content">
<Setter Property="Grid.Row" Value="1" />
<Setter Property="Grid.Column" Value="0" />
<Setter Property="HorizontalContentAlignment" Value="Right" />
<Setter Property="HorizontalAlignment" Value="Right" />
</Style>
<Style Selector="^ /template/ TextBlock#PART_Time">
<Setter Property="Grid.Row" Value="2" />
<Setter Property="Grid.Column" Value="0" />
<Setter Property="TextAlignment" Value="Right" />
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="Margin" Value="8 2 8 12"></Setter>
</Style>
</Style>
<Style Selector="^:all-right">
<Style Selector="^ /template/ ContentPresenter#PART_Header"> <Style Selector="^ /template/ ContentPresenter#PART_Header">
<Setter Property="Grid.Row" Value="0" /> <Setter Property="Grid.Row" Value="0" />
<Setter Property="Grid.Column" Value="2" /> <Setter Property="Grid.Column" Value="2" />
@@ -172,6 +151,27 @@
<Setter Property="Margin" Value="8 2 8 12"></Setter> <Setter Property="Margin" Value="8 2 8 12"></Setter>
</Style> </Style>
</Style> </Style>
<Style Selector="^:all-right">
<Style Selector="^ /template/ ContentPresenter#PART_Header">
<Setter Property="Grid.Row" Value="0" />
<Setter Property="Grid.Column" Value="0" />
<Setter Property="HorizontalContentAlignment" Value="Right" />
<Setter Property="HorizontalAlignment" Value="Right" />
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_Content">
<Setter Property="Grid.Row" Value="1" />
<Setter Property="Grid.Column" Value="0" />
<Setter Property="HorizontalContentAlignment" Value="Right" />
<Setter Property="HorizontalAlignment" Value="Right" />
</Style>
<Style Selector="^ /template/ TextBlock#PART_Time">
<Setter Property="Grid.Row" Value="2" />
<Setter Property="Grid.Column" Value="0" />
<Setter Property="TextAlignment" Value="Right" />
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="Margin" Value="8 2 8 12"></Setter>
</Style>
</Style>
<Style Selector="^:separate"> <Style Selector="^:separate">
<Style Selector="^ /template/ ContentPresenter#PART_Header"> <Style Selector="^ /template/ ContentPresenter#PART_Header">
<Setter Property="Grid.Row" Value="0" /> <Setter Property="Grid.Row" Value="0" />

View File

@@ -8,6 +8,12 @@ public enum TimelineDisplayMode
Alternate, Alternate,
} }
/// <summary>
/// Placement of timeline.
/// Left means line is placed left to TimelineItem content.
/// Right means line is placed right to TimelineItem content.
/// Separate means line is placed between TimelineItem content and time.
/// </summary>
public enum TimelineItemDisplayMode public enum TimelineItemDisplayMode
{ {
Left, Left,

View File

@@ -169,12 +169,12 @@ public class TimelineItem: HeaderedContentControl
if (Mode == TimelineItemDisplayMode.Left) if (Mode == TimelineItemDisplayMode.Left)
{ {
max = Math.Max(max, time); max = Math.Max(max, time);
return (max, icon, 0); return (0, icon, max);
} }
if (Mode == TimelineItemDisplayMode.Right) if (Mode == TimelineItemDisplayMode.Right)
{ {
max = Math.Max(max, time); max = Math.Max(max, time);
return (0, icon, max); return (max , icon, 0);
} }
if (Mode == TimelineItemDisplayMode.Separate) if (Mode == TimelineItemDisplayMode.Separate)
{ {