feat: fix container default value issue.
This commit is contained in:
@@ -80,6 +80,7 @@
|
||||
Content="Step 5"
|
||||
Header="第五步"
|
||||
Mode="Separate"
|
||||
TimeFormat="yyyy-MM-dd"
|
||||
Type="Error" />
|
||||
</u:Timeline>
|
||||
</WrapPanel>
|
||||
|
||||
@@ -150,10 +150,11 @@ public class Timeline: ItemsControl
|
||||
{
|
||||
t.Bind(TimelineItem.TimeProperty, TimeMemberBinding);
|
||||
}
|
||||
t.SetCurrentValue(TimelineItem.TimeFormatProperty, TimeFormat);
|
||||
t.SetCurrentValue(TimelineItem.IconTemplateProperty, IconTemplate);
|
||||
t.SetCurrentValue(HeaderedContentControl.HeaderTemplateProperty, ItemTemplate);
|
||||
t.SetCurrentValue(ContentControl.ContentTemplateProperty, DescriptionTemplate);
|
||||
|
||||
t.SetIfUnset(TimelineItem.TimeFormatProperty, TimeFormat);
|
||||
t.SetIfUnset(TimelineItem.IconTemplateProperty, IconTemplate);
|
||||
t.SetIfUnset(HeaderedContentControl.HeaderTemplateProperty, ItemTemplate);
|
||||
t.SetIfUnset(ContentControl.ContentTemplateProperty, DescriptionTemplate);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -190,4 +190,12 @@ public class TimelineItem: HeaderedContentControl
|
||||
_rootGrid.ColumnDefinitions[1].Width = new GridLength(mid??0);
|
||||
_rootGrid.ColumnDefinitions[2].Width = new GridLength(right??0);
|
||||
}
|
||||
|
||||
internal void SetIfUnset<T>(AvaloniaProperty<T> property, T value)
|
||||
{
|
||||
if (!IsSet(property))
|
||||
{
|
||||
SetCurrentValue(property, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user