昨年かそこらの間、私はさまざまな目的のために、さまざまな作成者からさまざまな値コンバーターを見てきました。私の心に突き出ていることの 1 つは、それらによって返される「デフォルト」値のばらつきが大きいことです。例えば;
public class MyConverter: IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
// OK, we test for some undesirable, unconvertable situation, typically null...
if (value == null)
{
// And here are a variety of 'defaults' that I have seen, these begin the most typical.
return null;
return DependencyProperty.UnsetValue;
return Binding.DoNothing;
}
//...... other code.. whatever...
}}
私の質問は、入力値を変換できないことを示す「標準的な」方法はありますか?