Skip to end of metadata
Go to start of metadata

Remarks

You use GroupBox to represent a single object that defined in the Content property. To display a title to the GroupBox, you set the Header property to a string value that you desire.

The following example shows how to define a simple GroupBox in XAML.

XAML
GroupBox automatically measures the text width of the Header and draws a smooth round-corner 3D line around it, such as shown in the following figure.

You can customize many of the header settings and border appearance, add an image to the header, customize the header template and more. See GroupBox Overview to learn about these features.

Definition

public class GroupBox : ISHeaderedContentControl

Summary

The following table summarizes the members exposed in this class.

Public Constructors

GroupBox Constructor()Initializes a new instance of the GroupBox class.

Public Properties

BorderThicknessNot applicable, use StrokeThickness instead of BorderThickness.
HeaderDisplayModeSpecifies the mode of the content presentation.
HeaderFontSizeGets or sets the value that determines the font size of the header element.
HeaderForegroundRepresents the brush that describes the foreground color of the header element.
HeaderImageGets or sets the icon that appears in the header.
HeaderPositionSpecifies where the GroupBox should render the header element.
HeaderStyleGets or sets the style to apply to the header element of the group box.
HeaderVisibilityGets or sets the header element visibility.
ImageHeightSpecifies the height applied to the icon element.
ImageWidthSpecifies the width applied to the icon element.
RootElementGets the root element.
StrokeThicknessGets or sets the border thickness.
TextImageRelationSpecifies the position of the text and image relative to each other on a control.

Protected Properties

ProductProduct Info.

Fields

HeaderDisplayModePropertyIdentifies the HeaderDisplayMode dependency property.
HeaderFontSizePropertyIdentifies the HeaderFontSize dependency property.
HeaderForegroundPropertyIdentifies the HeaderForeground dependency property.
HeaderImagePropertyIdentifies the HeaderImage dependency property.
HeaderPositionPropertyIdentifies the HeaderPosition dependency property.
HeaderStylePropertyIdentifies the HeaderStyle dependency property.
HeaderVisibilityPropertyIdentifies the HeaderVisibility dependency property.
ImageHeightPropertyIdentifies the ImageHeight dependency property.
ImageWidthPropertyIdentifies the ImageWidth dependency property.
StrokeThicknessPropertyIdentifies the StrokeThickness dependency property.
TextImageRelationPropertyIdentifies the TextImageRelation dependency property.

Public Methods

AttachEventHandlers()Attach built-in event handlers to control templates. Call this method if necessary.
DetachedEventHandlers()Detach built-in event handlers from control templates. Call this method if necessary.
InitializeTemplates()Initializes control templates.
OnApplyTemplate()Builds the visual tree for the GroupBox when a new template is applied.
RefreshUIElement()Refresh the entire ui element using the latest configuration.

Protected Methods

OnContentChanged(object, object)Called when the value of the Content property changes.
OnCornerRadiusChanged()Called when the value of CornerRadius property changes.
OnHeaderChanged(object, object)Called when the value of the Header property changes.
OnHeaderTemplateChanged(DataTemplate, DataTemplate)Called when the value of the HeaderTemplate property changes.
OnHeaderVisibilityChanged()Occurs when the HeaderVisibility property changes.
RefreshHeaderUI()Invalidates the arrangement and dimension of the header element.

Public Constructors

public GroupBox()

Initializes a new instance of the GroupBox class.

Public Properties

public Thickness BorderThickness { get; set; }

Not applicable, use StrokeThickness instead of BorderThickness.

public ContentType HeaderDisplayMode { get; set; }

Specifies the mode of the content presentation.

public double HeaderFontSize { get; set; }

Gets or sets the value that determines the font size of the header element.

public Brush HeaderForeground { get; set; }

Represents the brush that describes the foreground color of the header element.

public ImageSource HeaderImage { get; set; }

Gets or sets the icon that appears in the header.

public HeaderPosition HeaderPosition { get; set; }

Specifies where the GroupBox should render the header element.

public Style HeaderStyle { get; set; }

Gets or sets the style to apply to the header element of the group box.

public Visibility HeaderVisibility { get; set; }

Gets or sets the header element visibility.

public double ImageHeight { get; set; }

Specifies the height applied to the icon element.

public double ImageWidth { get; set; }

Specifies the width applied to the icon element.

public Grid RootElement { get; }

Gets the root element.

public double StrokeThickness { get; set; }

Gets or sets the border thickness.

public TextImageRelation TextImageRelation { get; set; }

Specifies the position of the text and image relative to each other on a control.

Protected Properties

protected ProductInfo Product { get; }

Product Info.

Fields

public static readonly DependencyProperty HeaderDisplayModeProperty

Identifies the HeaderDisplayMode dependency property.

public static readonly DependencyProperty HeaderFontSizeProperty

Identifies the HeaderFontSize dependency property.

public static readonly DependencyProperty HeaderForegroundProperty

Identifies the HeaderForeground dependency property.

public static readonly DependencyProperty HeaderImageProperty

Identifies the HeaderImage dependency property.

public static readonly DependencyProperty HeaderPositionProperty

Identifies the HeaderPosition dependency property.

public static readonly DependencyProperty HeaderStyleProperty

Identifies the HeaderStyle dependency property.

public static readonly DependencyProperty HeaderVisibilityProperty

Identifies the HeaderVisibility dependency property.

public static readonly DependencyProperty ImageHeightProperty

Identifies the ImageHeight dependency property.

public static readonly DependencyProperty ImageWidthProperty

Identifies the ImageWidth dependency property.

public static readonly DependencyProperty StrokeThicknessProperty

Identifies the StrokeThickness dependency property.

public static readonly DependencyProperty TextImageRelationProperty

Identifies the TextImageRelation dependency property.

Public Methods

public void AttachEventHandlers()

Attach built-in event handlers to control templates. Call this method if necessary.

public void DetachedEventHandlers()

Detach built-in event handlers from control templates. Call this method if necessary.

public void InitializeTemplates()

Initializes control templates.

public void OnApplyTemplate()

Builds the visual tree for the GroupBox when a new template is applied.

public void RefreshUIElement()

Refresh the entire ui element using the latest configuration.

Protected Methods

protected void OnContentChanged(object oldContent, object newContent)

Called when the value of the Content property changes.

Parameters

oldContentThe old value of the Content property.
newContentThe new value of the Content property.

 

protected void OnCornerRadiusChanged()

Called when the value of CornerRadius property changes.

protected void OnHeaderChanged(object oldHeader, object newHeader)

Called when the value of the Header property changes.

Parameters

oldHeaderThe old value of the Header property.
newHeaderThe new value of the Header property.

 

protected void OnHeaderTemplateChanged(DataTemplate oldHeaderTemplate, DataTemplate newHeaderTemplate)

Called when the value of the HeaderTemplate property changes.

Parameters

oldHeaderTemplateThe old value of the HeaderTemplate property.
newHeaderTemplateThe new value of the HeaderTemplate property.

 

protected void OnHeaderVisibilityChanged()

Occurs when the HeaderVisibility property changes.

protected void RefreshHeaderUI()

Invalidates the arrangement and dimension of the header element.

  • No labels