Class SmartConverter
- Namespace
- SearchAThing.Desktop
- Assembly
- netcore-desktop.dll
Smart Converter
Parameter ( general form ):
?FN targetValueIfMatch targetValueIfNOTMatch
valueToMatch targetValueIfMatch targetValueIfNOTMatch
Functions:
- ?IsNull : true if given argument is null
- ?{gt,lt,gte,ltq,eq} v : true if given argument equals to parameter v
- ?{add,sub} v : add/sub v
- ?Lighter : double given argument brighness
- ?Lighter v : increase of given argument v=0-1 brighness
- ?Darker : half brighness
- ?Darker v : decrease to v=0-1 brightness
- ?Round dec : round value number to given decimals
Supported target types:
- boolean
- double
- Thickness
- Brush
- FontWeight
Examples ( converter parameter ):
true Yellow Transparent
( valueType: boolean, targetType:IBrush ) converts to Yellow if value is true or transparent if value if false?Darker 0.8
( valueType: IBrush, targetType: IBrush ) converts to darker brush reducing at 80% its bridhtness?IsNull 1.2 4.5
( valueType: object, targetType: double ) converts to 1.2 if value is null, 4.5 otherwisetrue false true
( valueType: bool, targetType: bool ) converts to false if given value is true, viceversa otherwise
public class SmartConverter : IValueConverter
- Inheritance
-
SmartConverter
- Implements
-
IValueConverter
- Inherited Members
Properties
Instance
public static SmartConverter Instance { get; }
Property Value
Methods
Convert(object?, Type, object, CultureInfo)
Converts a value.
public object? Convert(object? value, Type targetType, object parameter, CultureInfo culture)
Parameters
value
objectThe value to convert.
targetType
TypeThe type of the target.
parameter
objectA user-defined parameter.
culture
CultureInfoThe culture to use.
Returns
- object
The converted value.
Remarks
This method should not throw exceptions. If the value is not convertible, return a Avalonia.Data.BindingNotification in an error state. Any exceptions thrown will be treated as an application exception.
ConvertBack(object, Type, object, CultureInfo)
Converts a value.
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
Parameters
value
objectThe value to convert.
targetType
TypeThe type of the target.
parameter
objectA user-defined parameter.
culture
CultureInfoThe culture to use.
Returns
- object
The converted value.
Remarks
This method should not throw exceptions. If the value is not convertible, return a Avalonia.Data.BindingNotification in an error state. Any exceptions thrown will be treated as an application exception.
operand(object?, Type, object, CultureInfo, bool)
public object? operand(object? value, Type targetType, object parameter, CultureInfo culture, bool isBackCvt)
Parameters
value
objecttargetType
Typeparameter
objectculture
CultureInfoisBackCvt
bool