This commit is contained in:
NaBian committed 2020-04-05 23:07:20 +08:00
1 parent 0b666d7fa1
commit 91f68b5d8f
3 files changed
+12 -17

No files matched your search

@@ -232,15 +232,6 @@ namespace HandyControl.Controls
return;
}
if (IsAnimationEnabled)
{
HeaderPanel.SetCurrentValue(TabPanel.FluidMoveDurationProperty, new Duration(TimeSpan.FromMilliseconds(200)));
}
else
{
HeaderPanel.FluidMoveDuration = new Duration(TimeSpan.FromSeconds(0));
}
if (e.Action == NotifyCollectionChangedAction.Add)
{
for (var i = 0; i < Items.Count; i++)
@@ -252,7 +243,6 @@ namespace HandyControl.Controls
}
_headerBorder?.InvalidateMeasure();
IsInternalAction = false;
}
@@ -361,11 +351,11 @@ namespace HandyControl.Controls
list.Insert(0, actualItem);
if (IsAnimationEnabled)
{
HeaderPanel.SetCurrentValue(TabPanel.FluidMoveDurationProperty, new Duration(TimeSpan.FromMilliseconds(200)));
HeaderPanel.SetValue(TabPanel.FluidMoveDurationPropertyKey, new Duration(TimeSpan.FromMilliseconds(200)));
}
else
{
HeaderPanel.FluidMoveDuration = new Duration(TimeSpan.FromSeconds(0));
HeaderPanel.SetValue(TabPanel.FluidMoveDurationPropertyKey, new Duration(TimeSpan.FromMilliseconds(0)));
}
HeaderPanel.ForceUpdate = true;
HeaderPanel.Measure(new Size(HeaderPanel.DesiredSize.Width, ActualHeight));
@@ -280,7 +280,7 @@ namespace HandyControl.Controls
RaiseEvent(argsClosing);
if (argsClosing.Cancel) return;
TabPanel.SetCurrentValue(TabPanel.FluidMoveDurationProperty, parent.IsAnimationEnabled
TabPanel.SetValue(TabPanel.FluidMoveDurationPropertyKey, parent.IsAnimationEnabled
? new Duration(TimeSpan.FromMilliseconds(200))
: new Duration(TimeSpan.FromMilliseconds(1)));
@@ -302,7 +302,7 @@ namespace HandyControl.Controls
if (parent.IsDraggable && !ItemIsDragging && !_isDragging)
{
parent.UpdateScroll();
TabPanel.FluidMoveDuration = new Duration(TimeSpan.FromSeconds(0));
TabPanel.SetValue(TabPanel.FluidMoveDurationPropertyKey, new Duration(TimeSpan.FromSeconds(0)));
_mouseDownOffsetX = RenderTransform.Value.OffsetX;
_scrollHorizontalOffset = parent.GetHorizontalOffset();
var mx = TranslatePoint(new Point(), parent).X + _scrollHorizontalOffset;
@@ -407,6 +407,7 @@ namespace HandyControl.Controls
list.Remove(item);
parent.IsInternalAction = true;
list.Insert(index, item);
_tabPanel.SetValue(TabPanel.FluidMoveDurationPropertyKey, new Duration(TimeSpan.FromMilliseconds(0)));
TabPanel.CanUpdate = true;
TabPanel.ForceUpdate = true;
TabPanel.Measure(new Size(TabPanel.DesiredSize.Width, ActualHeight));
@@ -22,11 +22,15 @@ namespace HandyControl.Controls
/// </summary>
internal Dictionary<int, TabItem> ItemDic = new Dictionary<int, TabItem>();
public static readonly DependencyPropertyKey FluidMoveDurationPropertyKey =
DependencyProperty.RegisterReadOnly("FluidMoveDuration", typeof(Duration), typeof(TabPanel),
new PropertyMetadata(new Duration(TimeSpan.FromMilliseconds(0))));
/// <summary>
/// 流式行为持续时间
/// </summary>
public static readonly DependencyProperty FluidMoveDurationProperty = DependencyProperty.Register(
"FluidMoveDuration", typeof(Duration), typeof(TabPanel), new PropertyMetadata(new Duration(TimeSpan.FromMilliseconds(200))));
public static readonly DependencyProperty FluidMoveDurationProperty =
FluidMoveDurationPropertyKey.DependencyProperty;
/// <summary>
/// 流式行为持续时间
@@ -96,7 +100,7 @@ namespace HandyControl.Controls
protected override Size MeasureOverride(Size constraint)
{
if ((_itemCount == InternalChildren.Count || !CanUpdate) && !ForceUpdate) return _oldSize;
if ((_itemCount == InternalChildren.Count || !CanUpdate) && !ForceUpdate && !IsTabFillEnabled) return _oldSize;
constraint.Height = TabItemHeight;
_itemCount = InternalChildren.Count;