Julien Lebosquain
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
32 additions and
5 deletions
src/Avalonia.Base/Input/PinchEventArgs.cs
src/Avalonia.Base/Media/PolyLineSegment.cs
src/Avalonia.Controls/TabItem.cs
tests/Avalonia.Controls.UnitTests/TabControlTests.cs
@ -24,7 +24,7 @@ namespace Avalonia.Input
/// <summary>
/// Gets the angle of the pinch gesture, in degrees.
/// <summary>
/// </ summary>
/// <remarks>
/// 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.
/// </remarks>
@ -39,6 +39,8 @@ namespace Avalonia.Media
/// Initializes a new instance of the <see cref="PolyLineSegment"/> class.
/// </summary>
/// <param name="points">The points.</param>
[ System . Diagnostics . CodeAnalysis . SuppressMessage ( "AvaloniaProperty" , "AVP1012" ,
Justification = "Collection properties shouldn't be set with SetCurrentValue." ) ]
public PolyLineSegment ( IEnumerable < Point > points )
{
Points = new Points ( points ) ;
@ -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 ) ;
}
}
}
@ -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 < TabItem > ( ) )
{
Setters =
{
new Setter ( HeaderedContentControl . HeaderProperty , "Header from style" )
}
}
} ,
Child = tabItem
} ;
Assert . Equal ( "Header from style" , tabItem . Header ) ;
}
private static IControlTemplate TabControlTemplate ( )
{
return new FuncControlTemplate < TabControl > ( ( parent , scope ) = >