Class Caption
Represents a control that can be used to display text and a text indication.
Inheritance
Namespace: Sartorius.SAF.Presentation.Controls
Assembly: Sartorius.SAF.Presentation.Controls.dll
Syntax
[TemplatePart(Name = "PART_Text", Type = typeof(TextBlock))]
[TemplatePart(Name = "PART_Indicator", Type = typeof(TextBlock))]
[SuppressMessage("ReSharper", "LocalizableElement")]
public class Caption : Control, IAnimatable, ISupportInitialize, IFrameworkInputElement, IInputElement, IQueryAmbient
Remarks
This control is a replacement to the default Wpf TextBlock that lacks of indication possibilities. It is recommended to use a Caption rather than a TextBlock whenever possible.
The SAF also provides a style called 'SAF_ContentBoxCaption'.
Examples
This example illustrates how to use the Caption control to display a caption.
<SAF:Caption Text="Firstname" />
This example illustrates how to use the Caption control to display a caption with a 'Required' indicator (a '*' behind the text).
<SAF:Caption Text="Firstname"
Indicator="Required" />
This example illustrates how to use the Caption control to display a caption with a 'Required' indicator (a '*' behind the text) using a style.
<SAF:Caption Text="Firstname"
Indicator="Required"
Style="{DynamicResource SAF_ContentBoxCaption}" />
This example illustrates how to use the Caption control to display a caption with a 'Required' indicator (a '*' behind the text) and a Run element.
<SAF:Caption Indicator="Required">
X
<Run Text="p"
BaselineAlignment="Subscript"
FontSize="10" />
</SAF:Caption>
Fields
View SourceIndicatorFontSizeProperty
Dependency property for the IndicatorFontSize property.
Declaration
public static readonly DependencyProperty IndicatorFontSizeProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
IndicatorProperty
Dependency property for the Indicator property.
Declaration
public static readonly DependencyProperty IndicatorProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
IndicatorTextProperty
Dependency property for the IndicatorText property.
Declaration
public static readonly DependencyProperty IndicatorTextProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
IndicatorVisibilityProperty
The indicator visibility property
Declaration
public static readonly DependencyProperty IndicatorVisibilityProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
TextProperty
Dependency property for the Text property.
Declaration
public static readonly DependencyProperty TextProperty
Field Value
| Type | Description |
|---|---|
| DependencyProperty |
Properties
View SourceIndicator
Gets or sets the indicator of the caption.
Declaration
public Indicator Indicator { get; set; }
Property Value
| Type | Description |
|---|---|
| Indicator |
Remarks
The indicator is placed behind the Text.
IndicatorFontSize
Gets or sets the font size of the IndicatorText.
Declaration
public double IndicatorFontSize { get; }
Property Value
| Type | Description |
|---|---|
| double |
IndicatorText
Gets the indicator text that is auto generated based on the Indicator property.
Declaration
public string IndicatorText { get; }
Property Value
| Type | Description |
|---|---|
| string |
IndicatorVisibility
Gets or sets the indicator visibility.
Declaration
public Visibility IndicatorVisibility { get; set; }
Property Value
| Type | Description |
|---|---|
| Visibility |
Inlines
Gets the InlineCollection of the caption.
Declaration
public InlineCollection Inlines { get; }
Property Value
| Type | Description |
|---|---|
| InlineCollection |
Text
Gets or sets the text of the caption.
Declaration
public string Text { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
View SourceOnApplyTemplate()
When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate().
Declaration
public override void OnApplyTemplate()