HypernovaDesktop Components · docs
Binarymission
WPF › Rounded Corner Container › VisualElementHostSizeConverter

VisualElementHostSizeConverter

class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WPF.Controls.Containers

Combines a bound width and height into the shape the rounded corner container clips the visual it hosts to: a rectangle, or - given a corner radius as a third value - a rounded one, with each corner its own radius.

public class VisualElementHostSizeConverter : IMultiValueConverter

Inherits from / implements: IMultiValueConverter

Remarks

The rounded form exists because the radius cannot be bound on the geometry itself. A geometry is a Freezable and so is not in the element tree, which is what a RelativeSource binding needs to walk; such a binding is dropped with "Cannot find governing FrameworkElement" and the radius stays zero. Binding the border's Clip property instead puts the binding on the border, where it resolves, and the radius arrives here as a value.

Members at a glance

ConvertPerforms the conversion this converter exists for, as described on VisualElementHostSizeConverter.
ConvertBackNot supported. This conversion is one-way, so there is nothing to convert back to.

Methods

Convert

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

Performs the conversion this converter exists for, as described on VisualElementHostSizeConverter.

values
The values produced by the bindings in the multi-binding, in order.
targetType
The type the binding target expects.
parameter
The converter parameter given in the binding.
culture
The culture to use for the conversion.

Returns. The converted value.

ConvertBack

public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)

Not supported. This conversion is one-way, so there is nothing to convert back to.

value
The value produced by the binding source.
targetTypes
The types the binding targets expect.
parameter
The converter parameter given in the binding.
culture
The culture to use for the conversion.

Returns. No usable value.