我有一个带有自定义 BindableProperty 的自定义视图:
public string Valore {
get { return (string)GetValue(ValoreProperty); }
set { SetValue(ValoreProperty, value); }
}
public static readonly BindableProperty ValoreProperty =
BindableProperty.Create(
propertyName: nameof(Valore),
returnType: typeof(string),
declaringType: typeof(VolosTimePickerView),
defaultBindingMode: BindingMode.TwoWay,
propertyChanged: ValorePropertyChanged,
propertyChanging: ValorePropertyChanging
);
在我的 XAML 中,由于 的值为Valore
nullable Int
,我必须使用这样的转换器:
<view:VolosTimePickerView Grid.Row="0" Grid.Column="1"
Valore="{Binding OrariSelezionati.ViaggioInizioMattina, Converter={StaticResource NullableConverter}}" />
我怎样才能做同样的事情,而不是Converter={StaticResource NullableConverter
在 XAML 端使用,而是直接在属性后面的代码中使用?
谢谢!