|
@@ -23,7 +23,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|
|
{
|
|
|
bool executed = false;
|
|
|
|
|
|
- var template = new FuncControlTemplate(_ =>
|
|
|
+ var template = new FuncControlTemplate((_, __) =>
|
|
|
{
|
|
|
executed = true;
|
|
|
return new Control();
|
|
@@ -42,7 +42,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|
|
{
|
|
|
bool executed = false;
|
|
|
|
|
|
- var template = new FuncControlTemplate(_ =>
|
|
|
+ var template = new FuncControlTemplate((_, __) =>
|
|
|
{
|
|
|
executed = true;
|
|
|
return new Control();
|
|
@@ -63,7 +63,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|
|
{
|
|
|
var target = new TemplatedControl
|
|
|
{
|
|
|
- Template = new FuncControlTemplate(_ => new Decorator
|
|
|
+ Template = new FuncControlTemplate((_, __) => new Decorator
|
|
|
{
|
|
|
Child = new Panel
|
|
|
{
|
|
@@ -97,7 +97,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|
|
{
|
|
|
var target = new TemplatedControl
|
|
|
{
|
|
|
- Template = new FuncControlTemplate(_ => new Decorator
|
|
|
+ Template = new FuncControlTemplate((_, __) => new Decorator
|
|
|
{
|
|
|
Child = new Panel
|
|
|
{
|
|
@@ -120,7 +120,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|
|
{
|
|
|
var target = new TemplatedControl
|
|
|
{
|
|
|
- Template = new FuncControlTemplate(_ => new Decorator
|
|
|
+ Template = new FuncControlTemplate((_, __) => new Decorator
|
|
|
{
|
|
|
Child = new Panel
|
|
|
{
|
|
@@ -149,7 +149,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|
|
{
|
|
|
var target = new TemplatedControl
|
|
|
{
|
|
|
- Template = new FuncControlTemplate(_ => new Decorator())
|
|
|
+ Template = new FuncControlTemplate((_, __) => new Decorator())
|
|
|
};
|
|
|
|
|
|
target.ApplyTemplate();
|
|
@@ -165,14 +165,14 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|
|
{
|
|
|
var target = new TemplatedControl
|
|
|
{
|
|
|
- Template = new FuncControlTemplate(_ => new Decorator())
|
|
|
+ Template = new FuncControlTemplate((_, __) => new Decorator())
|
|
|
};
|
|
|
|
|
|
target.ApplyTemplate();
|
|
|
|
|
|
var child = (Decorator)target.GetVisualChildren().Single();
|
|
|
|
|
|
- target.Template = new FuncControlTemplate(_ => new Canvas());
|
|
|
+ target.Template = new FuncControlTemplate((_, __) => new Canvas());
|
|
|
target.ApplyTemplate();
|
|
|
|
|
|
Assert.Null(child.Parent);
|
|
@@ -183,7 +183,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|
|
{
|
|
|
var target = new TemplatedControl
|
|
|
{
|
|
|
- Template = new FuncControlTemplate(_ => new ScrollViewer())
|
|
|
+ Template = new FuncControlTemplate((_, __) => new ScrollViewer())
|
|
|
};
|
|
|
|
|
|
target.ApplyTemplate();
|
|
@@ -203,7 +203,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|
|
{
|
|
|
Child = target = new TestTemplatedControl
|
|
|
{
|
|
|
- Template = new FuncControlTemplate(_ =>
|
|
|
+ Template = new FuncControlTemplate((_, __) =>
|
|
|
{
|
|
|
return new StackPanel
|
|
|
{
|
|
@@ -232,11 +232,11 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|
|
{
|
|
|
var target = new TestTemplatedControl
|
|
|
{
|
|
|
- Template = new FuncControlTemplate(_ =>
|
|
|
+ Template = new FuncControlTemplate((_, __) =>
|
|
|
{
|
|
|
return new ContentControl
|
|
|
{
|
|
|
- Template = new FuncControlTemplate(parent =>
|
|
|
+ Template = new FuncControlTemplate((parent, ___) =>
|
|
|
{
|
|
|
return new Border
|
|
|
{
|
|
@@ -311,7 +311,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|
|
{
|
|
|
var target = new TestTemplatedControl
|
|
|
{
|
|
|
- Template = new FuncControlTemplate(_ => new Decorator())
|
|
|
+ Template = new FuncControlTemplate((_, __) => new Decorator())
|
|
|
};
|
|
|
|
|
|
var raised = false;
|
|
@@ -334,7 +334,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|
|
{
|
|
|
var target = new TestTemplatedControl
|
|
|
{
|
|
|
- Template = new FuncControlTemplate(_ => new Decorator
|
|
|
+ Template = new FuncControlTemplate((_, __) => new Decorator
|
|
|
{
|
|
|
Child = new Border(),
|
|
|
})
|
|
@@ -348,7 +348,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|
|
Assert.Equal(target, decorator.TemplatedParent);
|
|
|
Assert.Equal(target, border.TemplatedParent);
|
|
|
|
|
|
- target.Template = new FuncControlTemplate(_ => new Canvas());
|
|
|
+ target.Template = new FuncControlTemplate((_, __) => new Canvas());
|
|
|
|
|
|
// Templated children should not be removed here: the control may be re-added
|
|
|
// somewhere with the same template, so they could still be of use.
|
|
@@ -370,7 +370,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|
|
{
|
|
|
Child = new TestTemplatedControl
|
|
|
{
|
|
|
- Template = new FuncControlTemplate(_ => new Decorator
|
|
|
+ Template = new FuncControlTemplate((_, __) => new Decorator
|
|
|
{
|
|
|
Child = templateChild,
|
|
|
})
|
|
@@ -392,7 +392,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|
|
{
|
|
|
Child = new TestTemplatedControl
|
|
|
{
|
|
|
- Template = new FuncControlTemplate(_ => new Decorator
|
|
|
+ Template = new FuncControlTemplate((_, __) => new Decorator
|
|
|
{
|
|
|
Child = templateChild,
|
|
|
})
|
|
@@ -425,7 +425,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|
|
{
|
|
|
new Setter(
|
|
|
TemplatedControl.TemplateProperty,
|
|
|
- new FuncControlTemplate(_ => new Decorator
|
|
|
+ new FuncControlTemplate((_, __) => new Decorator
|
|
|
{
|
|
|
Child = new Border(),
|
|
|
}))
|
|
@@ -461,7 +461,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|
|
{
|
|
|
new Setter(
|
|
|
TemplatedControl.TemplateProperty,
|
|
|
- new FuncControlTemplate(_ => new Decorator
|
|
|
+ new FuncControlTemplate((_, __) => new Decorator
|
|
|
{
|
|
|
Child = new Border(),
|
|
|
}))
|
|
@@ -500,7 +500,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|
|
{
|
|
|
new Setter(
|
|
|
TemplatedControl.TemplateProperty,
|
|
|
- new FuncControlTemplate(_ => new Decorator
|
|
|
+ new FuncControlTemplate((_, __) => new Decorator
|
|
|
{
|
|
|
Child = new Border(),
|
|
|
}))
|
|
@@ -520,7 +520,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|
|
{
|
|
|
new Setter(
|
|
|
TemplatedControl.TemplateProperty,
|
|
|
- new FuncControlTemplate(_ => new Decorator
|
|
|
+ new FuncControlTemplate((_, __) => new Decorator
|
|
|
{
|
|
|
Child = new Border(),
|
|
|
}))
|
|
@@ -555,7 +555,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|
|
{
|
|
|
Child = target = new TestTemplatedControl
|
|
|
{
|
|
|
- Template = new FuncControlTemplate(_ => new Decorator()),
|
|
|
+ Template = new FuncControlTemplate((_, __) => new Decorator()),
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -573,7 +573,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private static IControl ScrollingContentControlTemplate(ContentControl control)
|
|
|
+ private static IControl ScrollingContentControlTemplate(ContentControl control, INameScope scope)
|
|
|
{
|
|
|
return new Border
|
|
|
{
|
|
@@ -585,20 +585,20 @@ namespace Avalonia.Controls.UnitTests.Primitives
|
|
|
{
|
|
|
Name = "PART_ContentPresenter",
|
|
|
[!ContentPresenter.ContentProperty] = control[!ContentControl.ContentProperty],
|
|
|
- }
|
|
|
- }
|
|
|
- };
|
|
|
+ }.RegisterInNameScope(scope)
|
|
|
+ }.RegisterInNameScope(scope)
|
|
|
+ }.WithNameScope(scope);
|
|
|
}
|
|
|
|
|
|
- private static Control ScrollViewerTemplate(ScrollViewer control)
|
|
|
+ private static Control ScrollViewerTemplate(ScrollViewer control, INameScope scope)
|
|
|
{
|
|
|
var result = new ScrollContentPresenter
|
|
|
{
|
|
|
Name = "PART_ContentPresenter",
|
|
|
[~ContentPresenter.ContentProperty] = control[~ContentControl.ContentProperty],
|
|
|
- };
|
|
|
+ }.RegisterInNameScope(scope).WithNameScope(scope);
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
+}
|