IValueConverter
を使用すると、同じ値を返すIMultiValueConverter
が返されますが、それはなぜですか?なぜマルチバインディングがCornerRadiusで機能しないのですか
<Border Background="Red" Width="100" Height="100"
CornerRadius="{Binding Converter={vc:SingleAndMultiConverter}}" />
<Border Background="Red" Width="100" Height="100"
CornerRadius="{MultiBinding Converter={vc:SingleAndMultiConverter}}" />
public class SingleAndMultiConverter : MarkupExtension, IValueConverter, IMultiValueConverter
{
public override object ProvideValue(IServiceProvider serviceProvider)
{
return this;
}
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return Convert();
}
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return Convert();
}
private object Convert()
{
return 15;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotSupportedException();
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotSupportedException();
}
}
多結合このエラーをスロー:
Value produced by BindingExpression is not valid for target property.; Value='15'
は、先生はちょっと –
...あなたが何か間違ったことをやっているが、私達に関連するコードを示していないと述べ、これはほぼすべての私のコードです。 あなたがコードを読むには、ideで生成してください。 – GeminiYellow
今、このトラブルから私を助けてくれますか? – GeminiYellow