In This Article

BorderChildClipConverter Class

Represents a multi-value converter that can be applied to a Border.Child element's Clip property to ensure the child element is properly clipped based on the Border.CornerRadius value.

public class BorderChildClipConverter
Inheritance:
object object

Remarks

This converter is useful when the Border.Child element or another element within its hierarchy has a background that renders into the portion of the parent Border that is normally rounded off by the corner radius.

Examples

<Border x:Name="outerBorder" BorderBrush="Black" BorderThickness="1" CornerRadius="8">
    <Grid>
        <Grid.Clip>
            <MultiBinding Converter="{StaticResource BorderClipConverter}">
                <Binding RelativeSource="{RelativeSource Self}" Path="ActualWidth" />
                <Binding RelativeSource="{RelativeSource Self}" Path="ActualHeight" />
                <Binding ElementName="outerBorder" Path="BorderThickness" />
                <Binding ElementName="outerBorder" Path="CornerRadius" />
            </MultiBinding>
        </Grid.Clip>
        <!-- Grid child controls here -->
    </Grid>
</Border>

Constructors

BorderChildClipConverter()

Initializes an instance of the class.

public BorderChildClipConverter()

Methods

Convert(object?[], Type, object?, CultureInfo)

Converts source values to a value for the binding target. The data binding engine calls this method when it propagates the values from source bindings to the binding target.

public object? Convert(object?[] values, Type targetType, object? parameter, CultureInfo culture)
Parameter Type Description
values object[]

The array of values that the source bindings in the MultiBinding produces. The value System.Windows.DependencyProperty.UnsetValue indicates that the source binding has no value to provide for conversion.

targetType Type

The type of the binding target property.

parameter object

The converter parameter to use.

culture CultureInfo

The culture to use in the converter.

Returns

object:

A converted value.

If the method returns null, the valid null value is used.

A return value of System.Windows.DependencyProperty.System.Windows.DependencyProperty.UnsetValue indicates that the converter did not produce a value, and that the binding will use the FallbackValue if it is available, or else will use the default value.

A return value of Binding.DoNothing indicates that the binding does not transfer the value or use the FallbackValue or the default value.

ConvertBack(object?, Type[], object?, CultureInfo)

Converts a binding target value to the source binding values.

public object?[]? ConvertBack(object? value, Type[] targetTypes, object? parameter, CultureInfo culture)
Parameter Type Description
value object

The value that the binding target produces.

targetTypes Type[]

The array of types to convert to. The array length indicates the number and types of values that are suggested for the method to return.

parameter object

The converter parameter to use.

culture CultureInfo

The culture to use in the converter.

Returns

object[]:

An array of values that have been converted from the target value back to the source values.

Inherited Members

Extension Methods