diff --git a/src/Avalonia.Base/Input/PinchEventArgs.cs b/src/Avalonia.Base/Input/PinchEventArgs.cs
index a1aaffe6dc..be373f443a 100644
--- a/src/Avalonia.Base/Input/PinchEventArgs.cs
+++ b/src/Avalonia.Base/Input/PinchEventArgs.cs
@@ -24,7 +24,7 @@ namespace Avalonia.Input
///
/// Gets the angle of the pinch gesture, in degrees.
- ///
+ ///
///
/// A pinch gesture is the movement of two pressed points closer together. This property is the measured angle of the line between those two points. Remember zero degrees is a line pointing up.
///
diff --git a/src/Avalonia.Base/Media/PolyLineSegment.cs b/src/Avalonia.Base/Media/PolyLineSegment.cs
index 49c34fea66..da87a2155b 100644
--- a/src/Avalonia.Base/Media/PolyLineSegment.cs
+++ b/src/Avalonia.Base/Media/PolyLineSegment.cs
@@ -39,6 +39,8 @@ namespace Avalonia.Media
/// Initializes a new instance of the class.
///
/// The points.
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("AvaloniaProperty", "AVP1012",
+ Justification = "Collection properties shouldn't be set with SetCurrentValue.")]
public PolyLineSegment(IEnumerable points)
{
Points = new Points(points);
diff --git a/src/Avalonia.Controls/TabItem.cs b/src/Avalonia.Controls/TabItem.cs
index 56eba0690d..c0bb19dd1f 100644
--- a/src/Avalonia.Controls/TabItem.cs
+++ b/src/Avalonia.Controls/TabItem.cs
@@ -72,14 +72,14 @@ namespace Avalonia.Controls
{
if (Header != headered.Header)
{
- Header = headered.Header;
+ SetCurrentValue(HeaderProperty, headered.Header);
}
}
else
{
if (!(obj.NewValue is Control))
{
- Header = obj.NewValue;
+ SetCurrentValue(HeaderProperty, obj.NewValue);
}
}
}
@@ -87,7 +87,7 @@ namespace Avalonia.Controls
{
if (Header == obj.OldValue)
{
- Header = obj.NewValue;
+ SetCurrentValue(HeaderProperty, obj.NewValue);
}
}
}
diff --git a/tests/Avalonia.Controls.UnitTests/TabControlTests.cs b/tests/Avalonia.Controls.UnitTests/TabControlTests.cs
index 7721018453..0a409f1ef5 100644
--- a/tests/Avalonia.Controls.UnitTests/TabControlTests.cs
+++ b/tests/Avalonia.Controls.UnitTests/TabControlTests.cs
@@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
-using Avalonia.Collections;
using Avalonia.Controls.Presenters;
using Avalonia.Controls.Primitives;
using Avalonia.Controls.Selection;
@@ -547,6 +546,32 @@ namespace Avalonia.Controls.UnitTests
Assert.Same(item, root.FocusManager.GetFocusedElement());
}
+ [Fact]
+ public void TabItem_Header_Should_Be_Settable_By_Style_When_DataContext_Is_Set()
+ {
+ var tabItem = new TabItem
+ {
+ DataContext = "Some DataContext"
+ };
+
+ _ = new TestRoot
+ {
+ Styles =
+ {
+ new Style(x => x.OfType())
+ {
+ Setters =
+ {
+ new Setter(HeaderedContentControl.HeaderProperty, "Header from style")
+ }
+ }
+ },
+ Child = tabItem
+ };
+
+ Assert.Equal("Header from style", tabItem.Header);
+ }
+
private static IControlTemplate TabControlTemplate()
{
return new FuncControlTemplate((parent, scope) =>