Browse Source
The new <Template> is a template that can be used as a setter value, meaning that the setter will materialize the template each time it sets the value. Make assigning a control to `Setter.Value` throw an error indicating that the control should be wrapped in a template.pull/569/head
9 changed files with 88 additions and 22 deletions
@ -0,0 +1,10 @@ |
|||
// 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.
|
|||
|
|||
namespace Avalonia.Styling |
|||
{ |
|||
public interface ITemplate |
|||
{ |
|||
object Build(); |
|||
} |
|||
} |
|||
@ -1,10 +1,19 @@ |
|||
// 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 Avalonia.Controls; |
|||
using Avalonia.Metadata; |
|||
using Avalonia.Styling; |
|||
|
|||
namespace Avalonia.Markup.Xaml.Templates |
|||
{ |
|||
public class Template |
|||
public class Template : ITemplate<IControl> |
|||
{ |
|||
[Content] |
|||
public TemplateContent Content { get; set; } |
|||
|
|||
public IControl Build() => Content.Load(); |
|||
|
|||
object ITemplate.Build() => Build(); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue