diff --git a/Perspex.Controls/Primitives/TemplatedControl.cs b/Perspex.Controls/Primitives/TemplatedControl.cs
index 0601b08f5d..12f8a3f1ca 100644
--- a/Perspex.Controls/Primitives/TemplatedControl.cs
+++ b/Perspex.Controls/Primitives/TemplatedControl.cs
@@ -16,32 +16,62 @@ namespace Perspex.Controls.Primitives
using Serilog;
using Serilog.Core.Enrichers;
+ ///
+ /// A lookless control whose visual appearance is defined by its .
+ ///
public class TemplatedControl : Control, ITemplatedControl
{
+ ///
+ /// Defines the property.
+ ///
public static readonly PerspexProperty BackgroundProperty =
Border.BackgroundProperty.AddOwner();
+ ///
+ /// Defines the property.
+ ///
public static readonly PerspexProperty BorderBrushProperty =
Border.BorderBrushProperty.AddOwner();
+ ///
+ /// Defines the property.
+ ///
public static readonly PerspexProperty BorderThicknessProperty =
Border.BorderThicknessProperty.AddOwner();
+ ///
+ /// Defines the property.
+ ///
public static readonly PerspexProperty FontFamilyProperty =
TextBlock.FontFamilyProperty.AddOwner();
+ ///
+ /// Defines the property.
+ ///
public static readonly PerspexProperty FontSizeProperty =
TextBlock.FontSizeProperty.AddOwner();
+ ///
+ /// Defines the property.
+ ///
public static readonly PerspexProperty FontStyleProperty =
TextBlock.FontStyleProperty.AddOwner();
+ ///
+ /// Defines the property.
+ ///
public static readonly PerspexProperty ForegroundProperty =
TextBlock.ForegroundProperty.AddOwner();
+ ///
+ /// Defines the property.
+ ///
public static readonly PerspexProperty PaddingProperty =
Decorator.PaddingProperty.AddOwner();
+ ///
+ /// Defines the property.
+ ///
public static readonly PerspexProperty TemplateProperty =
PerspexProperty.Register("Template");
@@ -49,6 +79,9 @@ namespace Perspex.Controls.Primitives
private ILogger templateLog;
+ ///
+ /// Initializes static members of the class.
+ ///
static TemplatedControl()
{
TemplateProperty.Changed.Subscribe(e =>
@@ -59,6 +92,9 @@ namespace Perspex.Controls.Primitives
});
}
+ ///
+ /// Initializes a new instance of the class.
+ ///
public TemplatedControl()
{
this.templateLog = Log.ForContext(new[]
@@ -69,64 +105,88 @@ namespace Perspex.Controls.Primitives
});
}
+ ///
+ /// Gets or sets the brush used to draw the control's background.
+ ///
public Brush Background
{
get { return this.GetValue(BackgroundProperty); }
set { this.SetValue(BackgroundProperty, value); }
}
+ ///
+ /// Gets or sets the brush used to draw the control's border.
+ ///
public Brush BorderBrush
{
get { return this.GetValue(BorderBrushProperty); }
set { this.SetValue(BorderBrushProperty, value); }
}
+ ///
+ /// Gets or sets the thickness of the control's border.
+ ///
public double BorderThickness
{
get { return this.GetValue(BorderThicknessProperty); }
set { this.SetValue(BorderThicknessProperty, value); }
}
+ ///
+ /// Gets or sets the font family used to draw the control's text.
+ ///
public string FontFamily
{
get { return this.GetValue(FontFamilyProperty); }
set { this.SetValue(FontFamilyProperty, value); }
}
+ ///
+ /// Gets or sets the size of the control's text in points.
+ ///
public double FontSize
{
get { return this.GetValue(FontSizeProperty); }
set { this.SetValue(FontSizeProperty, value); }
}
+ ///
+ /// Gets or sets the font style used to draw the control's text.
+ ///
public FontStyle FontStyle
{
get { return this.GetValue(FontStyleProperty); }
set { this.SetValue(FontStyleProperty, value); }
}
+ ///
+ /// Gets or sets the brush used to draw the control's text and other foreground elements.
+ ///
public Brush Foreground
{
get { return this.GetValue(ForegroundProperty); }
set { this.SetValue(ForegroundProperty, value); }
}
+ ///
+ /// Gets or sets the padding placed between the border of the control and its content.
+ ///
public Thickness Padding
{
get { return this.GetValue(PaddingProperty); }
set { this.SetValue(PaddingProperty, value); }
}
+ ///
+ /// Gets or sets the template that defines the control's appearance.
+ ///
public ControlTemplate Template
{
get { return this.GetValue(TemplateProperty); }
set { this.SetValue(TemplateProperty, value); }
}
- public override void Render(IDrawingContext context)
- {
- }
-
+ ///
public sealed override void ApplyTemplate()
{
if (!this.templateApplied)
@@ -154,10 +214,18 @@ namespace Perspex.Controls.Primitives
}
}
+ ///
+ /// Called when the control's template is applied.
+ ///
protected virtual void OnTemplateApplied()
{
}
+ ///
+ /// Sets the property of the control and decendents until
+ /// an is found.
+ ///
+ /// The control.
private void SetTemplatedParent(Control control)
{
control.TemplatedParent = this;