File

projects/wms-framework/src/lib/baseframework/SmColorToBrushConverter.ts

Description

Helper for manipulating Color to Brush conversion

Implements

IValueConverter

Index

Methods

Methods

Convert
Convert(value: any, targetType: RuntimeTypeInfo, parameter: any, culture: any)

Converts the SmColor value to SolidColorBrush

Parameters :
Name Type Optional
value any No
targetType RuntimeTypeInfo No
parameter any No
culture any No
Returns : any
ConvertBack
ConvertBack(value: any, targetType: RuntimeTypeInfo, parameter: any, culture: any)

Converts the SolidColorBrush value to the respective SmColor value

Parameters :
Name Type Optional
value any No
targetType RuntimeTypeInfo No
parameter any No
culture any No
Returns : any
import { IValueConverter } from '../basecomponentmodel/IValueConverter';
import { SmColor } from '../media/color';
import { SolidColorBrush } from '../media/SolidColorBrush';
import { RuntimeTypeInfo } from './ReflectionSupport';

/**
 * Helper for manipulating Color to Brush conversion
 *
 * @export
 * @class SmEnumHelper
 * @wType Telerik.Windows.Controls.ColorToBrushConverter
 */
export class SmColorToBrushConverter implements IValueConverter {
  /**
   * Converts the SmColor value to SolidColorBrush
   *
   * @param {*} value
   * @param {RuntimeTypeInfo} targetType
   * @param {*} parameter
   * @param {*} culture
   * @returns
   * @memberof SmColorToBrushConverter
   */
  Convert(
    value: any,
    targetType: RuntimeTypeInfo,
    parameter: any,
    culture: any
  ) {
    var solidColorBrush = new SolidColorBrush();
    if (value != null) solidColorBrush.Color = value as SmColor;
    return solidColorBrush;
  }

  /**
   * Converts the SolidColorBrush value to the respective SmColor value
   *
   * @param {*} value
   * @param {RuntimeTypeInfo} targetType
   * @param {*} parameter
   * @param {*} culture
   * @returns
   * @memberof SmColorToBrushConverter
   */
  ConvertBack(
    value: any,
    targetType: RuntimeTypeInfo,
    parameter: any,
    culture: any
  ) {
    return value instanceof SolidColorBrush ? value.Color : null;
  }
}

result-matching ""

    No results matching ""