Convert() public method

Converts a value to the string representation.
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
Exemplo n.º 1
0
        public void True_Converts_To_Visible()
        {
            var conv = new BoolVisibleConverter();

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

            Assert.AreEqual(Visibility.Visible, result);
        }
Exemplo n.º 2
0
        public void Null_With_Not_Param_Converts_To_Visible()
        {
            var conv = new BoolVisibleConverter();

            var result = conv.Convert(null, typeof(Visibility), "not", CultureInfo.CurrentCulture);

            Assert.AreEqual(Visibility.Visible, result);
        }
Exemplo n.º 3
0
        public void Null_Converts_To_Collapsed()
        {
            var conv = new BoolVisibleConverter();

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

            Assert.AreEqual(Visibility.Collapsed, result);
        }
Exemplo n.º 4
0
        public void Unsupported_Obj_Converts_To_Collapsed()
        {
            var conv = new BoolVisibleConverter();

            var result = conv.Convert(new { blah = "blah" }, typeof(Visibility), null, CultureInfo.CurrentCulture);

            Assert.AreEqual(Visibility.Collapsed, result);
        }
Exemplo n.º 5
0
        public void True_With_Not_Param_Converts_To_Collapsed()
        {
            var conv = new BoolVisibleConverter();

            var result = conv.Convert(true, typeof(Visibility), "not", CultureInfo.CurrentCulture);

            Assert.AreEqual(Visibility.Collapsed, result);
        }
Exemplo n.º 6
0
        public void Unsupported_Obj_With_Not_Param_Converts_To_Visible()
        {
            var conv = new BoolVisibleConverter();

            var result = conv.Convert(new { blah = "blah" }, typeof(Visibility), "not", CultureInfo.CurrentCulture);

            Assert.AreEqual(Visibility.Visible, result);
        }