【发布时间】:2015-10-31 16:10:54
【问题描述】:
目前无法绑定到通用 XAML 应用程序中的任何 Nullable<T> 是否正确?
我从 2013 年找到了这个链接:
声明:
Windows 8 应用商店应用不支持绑定到可为空的值。它只是没有进入这个版本。我们已经为 v.Next 发现了这种行为的错误。
但这真的是还没解决吗?
我的绑定:
<TextBox Text="{Binding Serves, Mode=TwoWay}" Header="Serves"/>
我的财产:
public int? Serves
{
get { return _serves; ; }
set
{
_serves = value;
OnPropertyChanged();
}
}
我在输出中遇到的错误:
Error: Cannot save value from target back to source.
BindingExpression:
Path='Serves'
DataItem='MyAssembly.MyNamespace.RecipeViewModel, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'; target element is 'Windows.UI.Xaml.Controls.TextBox' (Name='null'); target property is 'Text' (type 'String').
【问题讨论】:
标签: c# data-binding uwp