diff --git a/native/Avalonia.Native/src/OSX/SystemDialogs.mm b/native/Avalonia.Native/src/OSX/SystemDialogs.mm
index 7049f77d20..567dd7f747 100644
--- a/native/Avalonia.Native/src/OSX/SystemDialogs.mm
+++ b/native/Avalonia.Native/src/OSX/SystemDialogs.mm
@@ -45,8 +45,7 @@ public:
{
auto url = [urls objectAtIndex:i];
- auto string = [url absoluteString];
- string = [string substringFromIndex:7];
+ auto string = [url path];
strings[i] = (void*)[string UTF8String];
}
@@ -137,8 +136,7 @@ public:
{
auto url = [urls objectAtIndex:i];
- auto string = [url absoluteString];
- string = [string substringFromIndex:7];
+ auto string = [url path];
strings[i] = (void*)[string UTF8String];
}
@@ -220,8 +218,7 @@ public:
auto url = [panel URL];
- auto string = [url absoluteString];
- string = [string substringFromIndex:7];
+ auto string = [url path];
strings[0] = (void*)[string UTF8String];
events->OnCompleted(1, &strings[0]);
diff --git a/src/Avalonia.Controls/Control.cs b/src/Avalonia.Controls/Control.cs
index a7ee027e70..ca5edae4a9 100644
--- a/src/Avalonia.Controls/Control.cs
+++ b/src/Avalonia.Controls/Control.cs
@@ -1,6 +1,7 @@
// Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
+using System;
using System.ComponentModel;
using Avalonia.Controls.Primitives;
using Avalonia.Controls.Templates;
@@ -20,7 +21,7 @@ namespace Avalonia.Controls
///
/// - A property to allow user-defined data to be attached to the control.
///
- public class Control : InputElement, IControl, INamed, ISupportInitialize, IVisualBrushInitialize, IRequiresTemplateInSetter
+ public class Control : InputElement, IControl, INamed, ISupportInitialize, IVisualBrushInitialize, ISetterValue
{
///
/// Defines the property.
@@ -90,6 +91,13 @@ namespace Avalonia.Controls
///
bool IDataTemplateHost.IsDataTemplatesInitialized => _dataTemplates != null;
+ ///
+ void ISetterValue.Initialize(ISetter setter)
+ {
+ throw new InvalidOperationException(
+ "Cannot use a control as a Setter value. Wrap the control in a .");
+ }
+
///
void IVisualBrushInitialize.EnsureInitialized()
{
diff --git a/src/Avalonia.Controls/Image.cs b/src/Avalonia.Controls/Image.cs
index c696fe7975..fa6f5787be 100644
--- a/src/Avalonia.Controls/Image.cs
+++ b/src/Avalonia.Controls/Image.cs
@@ -81,23 +81,22 @@ namespace Avalonia.Controls
protected override Size MeasureOverride(Size availableSize)
{
var source = Source;
+ var result = new Size();
if (source != null)
{
Size sourceSize = new Size(source.PixelSize.Width, source.PixelSize.Height);
if (double.IsInfinity(availableSize.Width) || double.IsInfinity(availableSize.Height))
{
- return sourceSize;
+ result = sourceSize;
}
else
{
- return Stretch.CalculateSize(availableSize, sourceSize);
+ result = Stretch.CalculateSize(availableSize, sourceSize);
}
}
- else
- {
- return new Size();
- }
+
+ return result.Constrain(availableSize);
}
///
diff --git a/src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs b/src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs
index 942104d61b..73854b9f60 100644
--- a/src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs
+++ b/src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs
@@ -336,7 +336,18 @@ namespace Avalonia.Controls.Platform
if (e.MouseButton == MouseButton.Left && item?.HasSubMenu == true)
{
- Open(item, false);
+ if (item.IsSubMenuOpen)
+ {
+ if (item.IsTopLevel)
+ {
+ CloseMenu(item);
+ }
+ }
+ else
+ {
+ Open(item, false);
+ }
+
e.Handled = true;
}
}
diff --git a/src/Avalonia.Controls/Shapes/Shape.cs b/src/Avalonia.Controls/Shapes/Shape.cs
index 57dbeba1cc..499dfb5320 100644
--- a/src/Avalonia.Controls/Shapes/Shape.cs
+++ b/src/Avalonia.Controls/Shapes/Shape.cs
@@ -21,13 +21,19 @@ namespace Avalonia.Controls.Shapes
public static readonly StyledProperty> StrokeDashArrayProperty =
AvaloniaProperty.Register>(nameof(StrokeDashArray));
-
+
public static readonly StyledProperty StrokeDashOffsetProperty =
AvaloniaProperty.Register(nameof(StrokeDashOffset));
public static readonly StyledProperty StrokeThicknessProperty =
AvaloniaProperty.Register(nameof(StrokeThickness));
+ public static readonly StyledProperty StrokeLineCapProperty =
+ AvaloniaProperty.Register(nameof(StrokeLineCap), PenLineCap.Flat);
+
+ public static readonly StyledProperty StrokeJoinProperty =
+ AvaloniaProperty.Register(nameof(StrokeJoin), PenLineJoin.Miter);
+
private Matrix _transform = Matrix.Identity;
private Geometry _definingGeometry;
private Geometry _renderedGeometry;
@@ -36,7 +42,9 @@ namespace Avalonia.Controls.Shapes
static Shape()
{
AffectsMeasure(StretchProperty, StrokeThicknessProperty);
- AffectsRender(FillProperty, StrokeProperty, StrokeDashArrayProperty);
+
+ AffectsRender(FillProperty, StrokeProperty, StrokeDashArrayProperty, StrokeDashOffsetProperty,
+ StrokeThicknessProperty, StrokeLineCapProperty, StrokeJoinProperty);
}
public Geometry DefiningGeometry
@@ -106,7 +114,7 @@ namespace Avalonia.Controls.Shapes
get { return GetValue(StrokeDashArrayProperty); }
set { SetValue(StrokeDashArrayProperty, value); }
}
-
+
public double StrokeDashOffset
{
get { return GetValue(StrokeDashOffsetProperty); }
@@ -119,13 +127,17 @@ namespace Avalonia.Controls.Shapes
set { SetValue(StrokeThicknessProperty, value); }
}
- public PenLineCap StrokeDashCap { get; set; } = PenLineCap.Flat;
-
- public PenLineCap StrokeStartLineCap { get; set; } = PenLineCap.Flat;
-
- public PenLineCap StrokeEndLineCap { get; set; } = PenLineCap.Flat;
+ public PenLineCap StrokeLineCap
+ {
+ get { return GetValue(StrokeLineCapProperty); }
+ set { SetValue(StrokeLineCapProperty, value); }
+ }
- public PenLineJoin StrokeJoin { get; set; } = PenLineJoin.Miter;
+ public PenLineJoin StrokeJoin
+ {
+ get { return GetValue(StrokeJoinProperty); }
+ set { SetValue(StrokeJoinProperty, value); }
+ }
public override void Render(DrawingContext context)
{
@@ -133,8 +145,8 @@ namespace Avalonia.Controls.Shapes
if (geometry != null)
{
- var pen = new Pen(Stroke, StrokeThickness, new DashStyle(StrokeDashArray, StrokeDashOffset),
- StrokeDashCap, StrokeStartLineCap, StrokeEndLineCap, StrokeJoin);
+ var pen = new Pen(Stroke, StrokeThickness, new DashStyle(StrokeDashArray, StrokeDashOffset),
+ StrokeLineCap, StrokeJoin);
context.DrawGeometry(Fill, pen, geometry);
}
}
@@ -169,11 +181,11 @@ namespace Avalonia.Controls.Shapes
protected void InvalidateGeometry()
{
- this._renderedGeometry = null;
- this._definingGeometry = null;
+ _renderedGeometry = null;
+ _definingGeometry = null;
InvalidateMeasure();
}
-
+
protected override Size MeasureOverride(Size availableSize)
{
bool deferCalculateTransform;
@@ -203,10 +215,10 @@ namespace Avalonia.Controls.Shapes
return CalculateShapeSizeAndSetTransform(availableSize);
}
}
-
+
protected override Size ArrangeOverride(Size finalSize)
{
- if(_calculateTransformOnArrange)
+ if (_calculateTransformOnArrange)
{
_calculateTransformOnArrange = false;
CalculateShapeSizeAndSetTransform(finalSize);
@@ -312,25 +324,25 @@ namespace Avalonia.Controls.Shapes
private static void AffectsGeometryInvalidate(AvaloniaPropertyChangedEventArgs e)
{
- var control = e.Sender as Shape;
+ if (!(e.Sender is Shape control))
+ {
+ return;
+ }
- if (control != null)
+ // If the geometry is invalidated when Bounds changes, only invalidate when the Size
+ // portion changes.
+ if (e.Property == BoundsProperty)
{
- // If the geometry is invalidated when Bounds changes, only invalidate when the Size
- // portion changes.
- if (e.Property == BoundsProperty)
- {
- var oldBounds = (Rect)e.OldValue;
- var newBounds = (Rect)e.NewValue;
+ var oldBounds = (Rect)e.OldValue;
+ var newBounds = (Rect)e.NewValue;
- if (oldBounds.Size == newBounds.Size)
- {
- return;
- }
+ if (oldBounds.Size == newBounds.Size)
+ {
+ return;
}
-
- control.InvalidateGeometry();
}
+
+ control.InvalidateGeometry();
}
}
}
diff --git a/src/Avalonia.Controls/StackPanel.cs b/src/Avalonia.Controls/StackPanel.cs
index 1f42e5d23e..0f55344769 100644
--- a/src/Avalonia.Controls/StackPanel.cs
+++ b/src/Avalonia.Controls/StackPanel.cs
@@ -4,6 +4,7 @@
using System;
using System.Linq;
using Avalonia.Input;
+using Avalonia.Layout;
namespace Avalonia.Controls
{
@@ -234,30 +235,16 @@ namespace Avalonia.Controls
measuredWidth -= (hasVisibleChild ? spacing : 0);
}
- return new Size(measuredWidth, measuredHeight);
+ return new Size(measuredWidth, measuredHeight).Constrain(availableSize);
}
- ///
- /// Arranges the control's children.
- ///
- /// The size allocated to the control.
- /// The space taken.
+ ///
protected override Size ArrangeOverride(Size finalSize)
{
var orientation = Orientation;
- double arrangedWidth = finalSize.Width;
- double arrangedHeight = finalSize.Height;
- double spacing = Spacing;
- bool hasVisibleChild = Children.Any(c => c.IsVisible);
-
- if (Orientation == Orientation.Vertical)
- {
- arrangedHeight = 0;
- }
- else
- {
- arrangedWidth = 0;
- }
+ var spacing = Spacing;
+ var finalRect = new Rect(finalSize);
+ var pos = 0.0;
var children = ReverseOrder ? Children.Reverse() : Children;
@@ -268,32 +255,21 @@ namespace Avalonia.Controls
if (orientation == Orientation.Vertical)
{
- double width = Math.Max(childWidth, arrangedWidth);
- Rect childFinal = new Rect(0, arrangedHeight, width, childHeight);
- ArrangeChild(child, childFinal, finalSize, orientation);
- arrangedWidth = Math.Max(arrangedWidth, childWidth);
- arrangedHeight += childHeight + (child.IsVisible ? spacing : 0);
+ var rect = new Rect(0, pos, childWidth, childHeight)
+ .Align(finalRect, child.HorizontalAlignment, VerticalAlignment.Top);
+ ArrangeChild(child, rect, finalSize, orientation);
+ pos += childHeight + spacing;
}
else
{
- double height = Math.Max(childHeight, arrangedHeight);
- Rect childFinal = new Rect(arrangedWidth, 0, childWidth, height);
- ArrangeChild(child, childFinal, finalSize, orientation);
- arrangedWidth += childWidth + (child.IsVisible ? spacing : 0);
- arrangedHeight = Math.Max(arrangedHeight, childHeight);
+ var rect = new Rect(pos, 0, childWidth, childHeight)
+ .Align(finalRect, HorizontalAlignment.Left, child.VerticalAlignment);
+ ArrangeChild(child, rect, finalSize, orientation);
+ pos += childWidth + spacing;
}
}
- if (orientation == Orientation.Vertical)
- {
- arrangedHeight = Math.Max(arrangedHeight - (hasVisibleChild ? spacing : 0), finalSize.Height);
- }
- else
- {
- arrangedWidth = Math.Max(arrangedWidth - (hasVisibleChild ? spacing : 0), finalSize.Width);
- }
-
- return new Size(arrangedWidth, arrangedHeight);
+ return finalSize;
}
internal virtual void ArrangeChild(
diff --git a/src/Avalonia.Controls/Viewbox.cs b/src/Avalonia.Controls/Viewbox.cs
index 3a070d07b2..781c93bcbe 100644
--- a/src/Avalonia.Controls/Viewbox.cs
+++ b/src/Avalonia.Controls/Viewbox.cs
@@ -49,7 +49,7 @@ namespace Avalonia.Controls
var scale = GetScale(availableSize, childSize, Stretch);
- return childSize * scale;
+ return (childSize * scale).Constrain(availableSize);
}
return new Size();
diff --git a/src/Avalonia.Layout/LayoutExtensions.cs b/src/Avalonia.Layout/LayoutExtensions.cs
new file mode 100644
index 0000000000..737bbb083c
--- /dev/null
+++ b/src/Avalonia.Layout/LayoutExtensions.cs
@@ -0,0 +1,62 @@
+using System;
+
+namespace Avalonia.Layout
+{
+ ///
+ /// Extension methods for layout types.
+ ///
+ public static class LayoutExtensions
+ {
+ ///
+ /// Aligns a rect in a constraining rect according to horizontal and vertical alignment
+ /// settings.
+ ///
+ /// The rect to align.
+ /// The constraining rect.
+ /// The horizontal alignment.
+ /// The vertical alignment.
+ ///
+ public static Rect Align(
+ this Rect rect,
+ Rect constraint,
+ HorizontalAlignment horizontalAlignment,
+ VerticalAlignment verticalAlignment)
+ {
+ switch (horizontalAlignment)
+ {
+ case HorizontalAlignment.Center:
+ rect = rect.WithX((constraint.Width - rect.Width) / 2);
+ break;
+ case HorizontalAlignment.Right:
+ rect = rect.WithX(constraint.Width - rect.Width);
+ break;
+ case HorizontalAlignment.Stretch:
+ rect = new Rect(
+ 0,
+ rect.Y,
+ Math.Max(constraint.Width, rect.Width),
+ rect.Height);
+ break;
+ }
+
+ switch (verticalAlignment)
+ {
+ case VerticalAlignment.Center:
+ rect = rect.WithY((constraint.Height - rect.Height) / 2);
+ break;
+ case VerticalAlignment.Bottom:
+ rect = rect.WithY(constraint.Height - rect.Height);
+ break;
+ case VerticalAlignment.Stretch:
+ rect = new Rect(
+ rect.X,
+ 0,
+ rect.Width,
+ Math.Max(constraint.Height, rect.Height));
+ break;
+ }
+
+ return rect;
+ }
+ }
+}
diff --git a/src/Avalonia.Layout/Layoutable.cs b/src/Avalonia.Layout/Layoutable.cs
index d5e3a1631e..662f48ec44 100644
--- a/src/Avalonia.Layout/Layoutable.cs
+++ b/src/Avalonia.Layout/Layoutable.cs
@@ -314,7 +314,7 @@ namespace Avalonia.Layout
try
{
_measuring = true;
- desiredSize = MeasureCore(availableSize).Constrain(availableSize);
+ desiredSize = MeasureCore(availableSize);
}
finally
{
diff --git a/src/Avalonia.Styling/Styling/IRequiresTemplateInSetter.cs b/src/Avalonia.Styling/Styling/IRequiresTemplateInSetter.cs
deleted file mode 100644
index 2d562b78d9..0000000000
--- a/src/Avalonia.Styling/Styling/IRequiresTemplateInSetter.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace Avalonia.Styling
-{
- ///
- /// This is an interface for advanced scenarios to assist users in correct style development.
- /// You as a user will not need to use this interface directly.
- ///
- public interface IRequiresTemplateInSetter
- {
- }
-}
diff --git a/src/Avalonia.Styling/Styling/ISetterValue.cs b/src/Avalonia.Styling/Styling/ISetterValue.cs
new file mode 100644
index 0000000000..63c544cf7d
--- /dev/null
+++ b/src/Avalonia.Styling/Styling/ISetterValue.cs
@@ -0,0 +1,13 @@
+namespace Avalonia.Styling
+{
+ ///
+ /// Customizes the behavior of a class when added as a value to an .
+ ///
+ public interface ISetterValue
+ {
+ ///
+ /// Notifies that the object has been added as a setter value.
+ ///
+ void Initialize(ISetter setter);
+ }
+}
diff --git a/src/Avalonia.Styling/Styling/Setter.cs b/src/Avalonia.Styling/Styling/Setter.cs
index cfe17a4291..3702259f35 100644
--- a/src/Avalonia.Styling/Styling/Setter.cs
+++ b/src/Avalonia.Styling/Styling/Setter.cs
@@ -65,13 +65,7 @@ namespace Avalonia.Styling
set
{
- if (value is IRequiresTemplateInSetter)
- {
- throw new ArgumentException(
- "Cannot assign a control to Setter.Value. Wrap the control in a .",
- nameof(value));
- }
-
+ (value as ISetterValue)?.Initialize(this);
_value = value;
}
}
diff --git a/src/Avalonia.Themes.Default/ScrollBar.xaml b/src/Avalonia.Themes.Default/ScrollBar.xaml
index 2cb8ce2d24..ca308b33c3 100644
--- a/src/Avalonia.Themes.Default/ScrollBar.xaml
+++ b/src/Avalonia.Themes.Default/ScrollBar.xaml
@@ -30,13 +30,7 @@
Classes="repeattrack"
Focusable="False"/>
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
+
+
diff --git a/src/Avalonia.Visuals/Media/BrushExtensions.cs b/src/Avalonia.Visuals/Media/BrushExtensions.cs
index cd351071dd..522953eb04 100644
--- a/src/Avalonia.Visuals/Media/BrushExtensions.cs
+++ b/src/Avalonia.Visuals/Media/BrushExtensions.cs
@@ -34,16 +34,14 @@ namespace Avalonia.Media
{
Contract.Requires(pen != null);
- var brush = pen?.Brush?.ToImmutable();
- return pen == null || ReferenceEquals(pen?.Brush, brush) ?
+ var brush = pen.Brush?.ToImmutable();
+ return ReferenceEquals(pen.Brush, brush) ?
pen :
new Pen(
brush,
thickness: pen.Thickness,
- dashStyle: pen.DashStyle,
- dashCap: pen.DashCap,
- startLineCap: pen.StartLineCap,
- endLineCap: pen.EndLineCap,
+ dashStyle: pen.DashStyle,
+ lineCap: pen.LineCap,
lineJoin: pen.LineJoin,
miterLimit: pen.MiterLimit);
}
diff --git a/src/Avalonia.Visuals/Media/Pen.cs b/src/Avalonia.Visuals/Media/Pen.cs
index ddd8091801..ee427c913b 100644
--- a/src/Avalonia.Visuals/Media/Pen.cs
+++ b/src/Avalonia.Visuals/Media/Pen.cs
@@ -11,63 +11,45 @@ namespace Avalonia.Media
///
/// Initializes a new instance of the class.
///
- /// The brush used to draw.
+ /// The stroke color.
/// The stroke thickness.
/// The dash style.
- /// The dash cap.
- /// The start line cap.
- /// The end line cap.
+ /// Specifies the type of graphic shape to use on both ends of a line.
/// The line join.
/// The miter limit.
public Pen(
- IBrush brush,
+ uint color,
double thickness = 1.0,
- DashStyle dashStyle = null,
- PenLineCap dashCap = PenLineCap.Flat,
- PenLineCap startLineCap = PenLineCap.Flat,
- PenLineCap endLineCap = PenLineCap.Flat,
- PenLineJoin lineJoin = PenLineJoin.Miter,
- double miterLimit = 10.0)
+ DashStyle dashStyle = null,
+ PenLineCap lineCap = PenLineCap.Flat,
+ PenLineJoin lineJoin = PenLineJoin.Miter,
+ double miterLimit = 10.0) : this(new SolidColorBrush(color), thickness, dashStyle, lineCap, lineJoin, miterLimit)
{
- Brush = brush;
- Thickness = thickness;
- DashCap = dashCap;
- StartLineCap = startLineCap;
- EndLineCap = endLineCap;
- LineJoin = lineJoin;
- MiterLimit = miterLimit;
- DashStyle = dashStyle;
}
///
/// Initializes a new instance of the class.
///
- /// The stroke color.
+ /// The brush used to draw.
/// The stroke thickness.
/// The dash style.
- /// The dash cap.
- /// The start line cap.
- /// The end line cap.
+ /// The line cap.
/// The line join.
/// The miter limit.
public Pen(
- uint color,
+ IBrush brush,
double thickness = 1.0,
- DashStyle dashStyle = null,
- PenLineCap dashCap = PenLineCap.Flat,
- PenLineCap startLineCap = PenLineCap.Flat,
- PenLineCap endLineCap = PenLineCap.Flat,
- PenLineJoin lineJoin = PenLineJoin.Miter,
+ DashStyle dashStyle = null,
+ PenLineCap lineCap = PenLineCap.Flat,
+ PenLineJoin lineJoin = PenLineJoin.Miter,
double miterLimit = 10.0)
{
- Brush = new SolidColorBrush(color);
+ Brush = brush;
Thickness = thickness;
- StartLineCap = startLineCap;
- EndLineCap = endLineCap;
+ LineCap = lineCap;
LineJoin = lineJoin;
MiterLimit = miterLimit;
DashStyle = dashStyle;
- DashCap = dashCap;
}
///
@@ -78,18 +60,26 @@ namespace Avalonia.Media
///
/// Gets the stroke thickness.
///
- public double Thickness { get; } = 1.0;
+ public double Thickness { get; }
+ ///
+ /// Specifies the style of dashed lines drawn with a object.
+ ///
public DashStyle DashStyle { get; }
- public PenLineCap DashCap { get; }
-
- public PenLineCap StartLineCap { get; } = PenLineCap.Flat;
-
- public PenLineCap EndLineCap { get; } = PenLineCap.Flat;
+ ///
+ /// Specifies the type of graphic shape to use on both ends of a line.
+ ///
+ public PenLineCap LineCap { get; }
- public PenLineJoin LineJoin { get; } = PenLineJoin.Miter;
+ ///
+ /// Specifies how to join consecutive line or curve segments in a (subpath) contained in a object.
+ ///
+ public PenLineJoin LineJoin { get; }
- public double MiterLimit { get; } = 10.0;
+ ///
+ /// The limit on the ratio of the miter length to half this pen's Thickness.
+ ///
+ public double MiterLimit { get; }
}
}
diff --git a/src/Avalonia.Visuals/Media/PenLineCap.cs b/src/Avalonia.Visuals/Media/PenLineCap.cs
index 56c5c040eb..83d8f11613 100644
--- a/src/Avalonia.Visuals/Media/PenLineCap.cs
+++ b/src/Avalonia.Visuals/Media/PenLineCap.cs
@@ -4,7 +4,6 @@ namespace Avalonia.Media
{
Flat,
Round,
- Square,
- Triangle
+ Square
}
}
diff --git a/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs b/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs
index 5293e1b978..5d1c66f872 100644
--- a/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs
+++ b/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs
@@ -5,7 +5,6 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
-using System.Threading;
using Avalonia.Media;
using Avalonia.Media.Immutable;
using Avalonia.Platform;
@@ -13,7 +12,6 @@ using Avalonia.Rendering.SceneGraph;
using Avalonia.Threading;
using Avalonia.Utilities;
using Avalonia.VisualTree;
-using System.Threading.Tasks;
namespace Avalonia.Rendering
{
@@ -33,7 +31,6 @@ namespace Avalonia.Rendering
private volatile IRef _scene;
private DirtyVisuals _dirty;
private IRef _overlay;
- private object _rendering = new object();
private int _lastSceneId = -1;
private DisplayDirtyRects _dirtyRectsDisplay = new DisplayDirtyRects();
private IRef _currentDraw;
@@ -267,7 +264,7 @@ namespace Avalonia.Rendering
RenderOverlay(scene.Item, GetContext());
if (updated || forceComposite || overlay)
RenderComposite(scene.Item, GetContext());
- }
+ }
}
}
finally
@@ -321,15 +318,15 @@ namespace Avalonia.Rendering
var (rs, _) = UpdateRenderLayersAndConsumeSceneIfNeeded(contextFactory, true);
return (rs, true);
}
-
+
// Indicate that we have updated the layers
return (sceneRef.Clone(), true);
}
-
+
// Just return scene, layers weren't updated
return (sceneRef.Clone(), false);
}
-
+
}
@@ -456,7 +453,7 @@ namespace Avalonia.Rendering
private void RenderComposite(Scene scene, IDrawingContextImpl context)
{
context.Clear(Colors.Transparent);
-
+
var clientRect = new Rect(scene.Size);
foreach (var layer in scene.Layers)
diff --git a/src/Markup/Avalonia.Markup/Data/TemplateBinding.cs b/src/Markup/Avalonia.Markup/Data/TemplateBinding.cs
index fab9bdbf55..e64efd9df9 100644
--- a/src/Markup/Avalonia.Markup/Data/TemplateBinding.cs
+++ b/src/Markup/Avalonia.Markup/Data/TemplateBinding.cs
@@ -3,6 +3,7 @@ using System.Globalization;
using System.Reactive.Subjects;
using Avalonia.Data.Converters;
using Avalonia.Reactive;
+using Avalonia.Styling;
namespace Avalonia.Data
{
@@ -12,8 +13,10 @@ namespace Avalonia.Data
public class TemplateBinding : SingleSubscriberObservableBase