Convert() public method

Converts a value.
public Convert ( object value, Type targetType, object parameter, System culture ) : object
value object The value produced by the binding source.
targetType System.Type The type of the binding target property.
parameter object The converter parameter to use.
culture System The culture to use in the converter.
return object
Ejemplo n.º 1
0
        public void Null_Converts_To_Detected_AppIcon()
        {
            var conv = new AppIconImageConverter();

            var result = conv.Convert(null, typeof(ImageSource), null, CultureInfo.CurrentCulture);

            Assert.AreSame(AppIconImageConverter.AppIcon, result);
        }
Ejemplo n.º 2
0
        public void Not_Null_Converts_To_Input()
        {
            var conv = new AppIconImageConverter();
            // an 8x3 bw image
            var input = BitmapSource.Create(8, 3, 96, 96, PixelFormats.BlackWhite, BitmapPalettes.BlackAndWhite, new byte[] { 0, 255, 0 }, 1);

            var result = conv.Convert(input, typeof(ImageSource), "not", CultureInfo.CurrentCulture);

            Assert.AreSame(input, result);
        }