BorderGapMaskConverter Class
Represents a converter that converts the dimensions of a GroupBox control into a VisualBrush.
Assembly: PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
The BorderGapMaskConverter type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | BorderGapMaskConverter | Initializes a new instance of the BorderGapMaskConverter class. |
| Name | Description | |
|---|---|---|
![]() | Convert | Creates a VisualBrush that draws the border for a GroupBox control. |
![]() | ConvertBack | Not implemented. |
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
The VisualBrush created by this converter applies an OpacityMask to the Border of the GroupBox so that it does not appear in the area defined for the Header of the GroupBox.
This example shows how to create a template for a GroupBox control.
The following example defines a GroupBox control template by using a Grid control for layout. The template uses a BorderGapMaskConverter to define the border of the GroupBox so that the border does not obscure the Header content.
<!--================================================================= GroupBox Template Example ==================================================================--> <BorderGapMaskConverter x:Key="BorderGapMaskConverter"/> <Style x:Key="{x:Type GroupBox}" TargetType="{x:Type GroupBox}"> <Setter Property="BorderBrush" Value="Gray"/> <Setter Property="Foreground" Value="White"/> <Setter Property="BorderThickness" Value="1"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type GroupBox}"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="4"/> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="*"/> <ColumnDefinition Width="4"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> <RowDefinition Height="4"/> </Grid.RowDefinitions> <Border CornerRadius="4" Grid.Row="1" Grid.RowSpan="3" Grid.Column="0" Grid.ColumnSpan="4" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="Transparent" Background="{TemplateBinding Background}"/> <!-- ContentPresenter for the header --> <Border x:Name="Header" Padding="6,0,6,0" Grid.Row="0" Grid.RowSpan="2" Grid.Column="1"> <ContentPresenter ContentSource="Header" RecognizesAccessKey="True" /> </Border> <!-- Primary content for GroupBox --> <ContentPresenter Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" Margin="{TemplateBinding Padding}"/> <Border CornerRadius="0" Grid.Row="1" Grid.RowSpan="3" Grid.ColumnSpan="4" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}"> <Border.OpacityMask> <MultiBinding Converter= "{StaticResource BorderGapMaskConverter}" ConverterParameter="6"> <Binding ElementName="Header" Path="ActualWidth"/> <Binding RelativeSource="{RelativeSource Self}" Path="ActualWidth"/> <Binding RelativeSource="{RelativeSource Self}" Path="ActualHeight"/> </MultiBinding> </Border.OpacityMask> </Border> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style>
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
