我正在用xamarin写我的第一个应用程序。我加载了一个页面,它初始化了一个列表的新项,因此我将一些整型和双精度变量与页面中的条目绑定在一起。当应用程序加载页面时,条目不包含任何内容,因此我必须在输入数据之前删除条目中的值。如何解决这个问题?
Actual Behaviour
Desired behaviour的
我正在用xamarin写我的第一个应用程序。我加载了一个页面,它初始化了一个列表的新项,因此我将一些整型和双精度变量与页面中的条目绑定在一起。当应用程序加载页面时,条目不包含任何内容,因此我必须在输入数据之前删除条目中的值。如何解决这个问题?
Actual Behaviour
Desired behaviour的
2条答案
按热度按时间jpfvwuh41#
正如Jonathan Willcock和Serge在评论中所说,将int改为int?如果没有值,可以使条目文本为空。
如果你想实现你的问题中的行为,可以使用这样的代码:
字符串
或者在xmal中:
型
yh2wf1be2#
你必须创建一个这样的转换器
字符串
就是这样使用的
型