Browse Source

fixes Should_Return_TargetNullValue_When_Value_Is_Null fails

pull/5007/head
Giuseppe Lippolis 6 years ago
parent
commit
8ed53d47be
  1. 15
      src/Markup/Avalonia.Markup/Data/MultiBinding.cs

15
src/Markup/Avalonia.Markup/Data/MultiBinding.cs

@ -48,7 +48,7 @@ namespace Avalonia.Data
/// Gets or sets the binding priority.
/// </summary>
public BindingPriority Priority { get; set; }
/// <summary>
/// Gets or sets the relative source for the binding.
/// </summary>
@ -77,12 +77,12 @@ namespace Avalonia.Data
// We only respect `StringFormat` if the type of the property we're assigning to will
// accept a string. Note that this is slightly different to WPF in that WPF only applies
// `StringFormat` for target type `string` (not `object`).
if (!string.IsNullOrWhiteSpace(StringFormat) &&
if (!string.IsNullOrWhiteSpace(StringFormat) &&
(targetType == typeof(string) || targetType == typeof(object)))
{
converter = new StringFormatMultiValueConverter(StringFormat, converter);
}
var children = Bindings.Select(x => x.Initiate(target, null));
var input = children.Select(x => x.Observable)
@ -116,8 +116,13 @@ namespace Avalonia.Data
}
var culture = CultureInfo.CurrentCulture;
var converted = converter?.Convert(values, targetType, ConverterParameter, culture)
?? values.ToArray();
object converted;
if (converter != null)
{
converted = converter.Convert(values, targetType, ConverterParameter, culture);
}
else
converted = values.ToArray();
if (converted == null)
{

Loading…
Cancel
Save