WPF › Tree List View › BooleanToCornerRadiusConverter
BooleanToCornerRadiusConverter
class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WPF.Controls.TreeControls.Converters
Turns a bool into a CornerRadius, so a switch in the control
can round a border the template draws.
public sealed class BooleanToCornerRadiusConverter : IValueConverter
Inherits from / implements: IValueConverter
Remarks
The radius used when the value is true is the converter parameter, read as a
number; without one it is four.
Members at a glance
| Methods | |
|---|---|
Convert | Gives the rounded radius for true and no rounding for anything else. |
ConvertBack | Reports whether a corner radius is rounded at all. |
Methods
Convert
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
Gives the rounded radius for true and no rounding for anything else.
Parameters
value- The switch, a
bool. targetType- Not used.
parameter- The radius to use when the value is
true, as a number or a string; four when it is missing. culture- Not used.
Returns
A CornerRadius.
ConvertBack
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
Reports whether a corner radius is rounded at all.
Parameters
value- A
CornerRadius. targetType- Not used.
parameter- Not used.
culture- Not used.
Returns
true when the top-left corner is rounded.