1
+ using System ;
2
+ using Avalonia . Collections ;
3
+ using Avalonia . Controls ;
4
+ using Avalonia . Controls . Shapes ;
5
+ using Avalonia . Controls . Utils ;
1
6
using Avalonia . Layout ;
7
+ using Avalonia . Media ;
2
8
using Avalonia . Metadata ;
9
+ using Avalonia . Platform ;
10
+ using Avalonia . Rendering . Composition ;
11
+ using Avalonia . Styling ;
12
+ using Avalonia . Utilities ;
13
+ using Avalonia . VisualTree ;
3
14
4
15
namespace Avalonia . Controls
5
16
{
6
17
/// <summary>
7
18
/// Base class for controls which decorate a single child control.
8
19
/// </summary>
9
- public class Decorator : Control
20
+ public class Decorator : Control , IContainer
10
21
{
11
22
/// <summary>
12
23
/// Defines the <see cref="Child"/> property.
@@ -20,6 +31,22 @@ public class Decorator : Control
20
31
public static readonly StyledProperty < Thickness > PaddingProperty =
21
32
AvaloniaProperty . Register < Decorator , Thickness > ( nameof ( Padding ) ) ;
22
33
34
+ /// <summary>
35
+ /// Defines the <see cref="ContainerName"/> property
36
+ /// </summary>
37
+ public static readonly StyledProperty < string ? > ContainerNameProperty =
38
+ AvaloniaProperty . Register < Decorator , string ? > ( nameof ( ContainerName ) ,
39
+ defaultValue : null ) ;
40
+
41
+ /// <summary>
42
+ /// Defines the <see cref="ContainerType"/> property
43
+ /// </summary>
44
+ public static readonly StyledProperty < ContainerType > ContainerTypeProperty =
45
+ AvaloniaProperty . Register < Decorator , ContainerType > ( nameof ( ContainerType ) ,
46
+ defaultValue : ContainerType . Normal ) ;
47
+
48
+ private VisualQueryProvider ? _queryProvider ;
49
+
23
50
/// <summary>
24
51
/// Initializes static members of the <see cref="Decorator"/> class.
25
52
/// </summary>
@@ -48,6 +75,23 @@ public Thickness Padding
48
75
set => SetValue ( PaddingProperty , value ) ;
49
76
}
50
77
78
+ /// <inheritdoc/>
79
+ public string ? ContainerName
80
+ {
81
+ get => GetValue ( ContainerNameProperty ) ;
82
+ set => SetValue ( ContainerNameProperty , value ) ;
83
+ }
84
+
85
+ /// <inheritdoc/>
86
+ public ContainerType ContainerType
87
+ {
88
+ get => GetValue ( ContainerTypeProperty ) ;
89
+ set => SetValue ( ContainerTypeProperty , value ) ;
90
+ }
91
+
92
+ /// <inheritdoc/>
93
+ public VisualQueryProvider QueryProvider => _queryProvider ??= new VisualQueryProvider ( this ) ;
94
+
51
95
/// <inheritdoc/>
52
96
protected override Size MeasureOverride ( Size availableSize )
53
97
{
0 commit comments