feat: use static naming.
This commit is contained in:
@@ -48,7 +48,7 @@
|
|||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
RowDefinitions="Auto, *">
|
RowDefinitions="Auto, *">
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Name="PART_Icon"
|
Name="{x:Static u:TimelineItem.PART_Icon}"
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Margin="8"
|
Margin="8"
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
Fill="{DynamicResource TimelineLineBrush}" />
|
Fill="{DynamicResource TimelineLineBrush}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Name="PART_Header"
|
Name="{x:Static u:TimelineItem.PART_Header}"
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
Margin="8,4"
|
Margin="8,4"
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
FontSize="14"
|
FontSize="14"
|
||||||
Foreground="{DynamicResource SemiGrey9}" />
|
Foreground="{DynamicResource SemiGrey9}" />
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Name="PART_Content"
|
Name="{x:Static u:TimelineItem.PART_Content}"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
Margin="8,2"
|
Margin="8,2"
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
TextElement.FontSize="12"
|
TextElement.FontSize="12"
|
||||||
TextElement.Foreground="Gray" />
|
TextElement.Foreground="Gray" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Name="PART_Time"
|
Name="{x:Static u:TimelineItem.PART_Time}"
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Margin="8,2"
|
Margin="8,2"
|
||||||
|
|||||||
@@ -138,12 +138,12 @@ public class TimelineItem: HeaderedContentControl
|
|||||||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||||
{
|
{
|
||||||
base.OnApplyTemplate(e);
|
base.OnApplyTemplate(e);
|
||||||
PseudoClasses.Set(PC_EmptyIcon, Icon is null);
|
|
||||||
_headerPresenter = e.NameScope.Find<ContentPresenter>(PART_Header);
|
_headerPresenter = e.NameScope.Find<ContentPresenter>(PART_Header);
|
||||||
_iconPresenter = e.NameScope.Find<ContentPresenter>(PART_Icon);
|
_iconPresenter = e.NameScope.Find<ContentPresenter>(PART_Icon);
|
||||||
_contentPresenter = e.NameScope.Find<ContentPresenter>(PART_Content);
|
_contentPresenter = e.NameScope.Find<ContentPresenter>(PART_Content);
|
||||||
_timePresenter = e.NameScope.Find<TextBlock>(PART_Time);
|
_timePresenter = e.NameScope.Find<TextBlock>(PART_Time);
|
||||||
_rootGrid = e.NameScope.Find<Grid>(PART_RootGrid);
|
_rootGrid = e.NameScope.Find<Grid>(PART_RootGrid);
|
||||||
|
PseudoClasses.Set(PC_EmptyIcon, Icon is null);
|
||||||
SetMode(Mode);
|
SetMode(Mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,6 +185,7 @@ public class TimelineItem: HeaderedContentControl
|
|||||||
|
|
||||||
internal void SetWidth(double? left, double? mid, double? right)
|
internal void SetWidth(double? left, double? mid, double? right)
|
||||||
{
|
{
|
||||||
|
if (_rootGrid is null) return;
|
||||||
_rootGrid.ColumnDefinitions[0].Width = new GridLength(left??0);
|
_rootGrid.ColumnDefinitions[0].Width = new GridLength(left??0);
|
||||||
_rootGrid.ColumnDefinitions[1].Width = new GridLength(mid??0);
|
_rootGrid.ColumnDefinitions[1].Width = new GridLength(mid??0);
|
||||||
_rootGrid.ColumnDefinitions[2].Width = new GridLength(right??0);
|
_rootGrid.ColumnDefinitions[2].Width = new GridLength(right??0);
|
||||||
|
|||||||
Reference in New Issue
Block a user