【发布时间】:2019-08-06 19:42:37
【问题描述】:
我希望这样我的用户不必每次在我的 xamarin.forms 应用程序上填写此表单时都输入 wifi 凭据。我试图找到一种方法来存储用户最后输入到条目中的值。有什么建议么?
我认为它可以像将它存储到字段中一样简单,如果它不为 null,但我收到一条错误消息,指出“只有赋值、调用、递增、递减、等待和新的 obect 表达式可以用作语句”
在我的班级顶部,我有字段。
string WifiNamePlaceholder;
然后在页面后面我有我的条目
if (WifiNamePlaceholder == null)
{
WifiNamePlaceholder = "Enter in your wifi credentials"
}
wifi_name = new Xamarin.Forms.Entry
{
BackgroundColor = Color.White,
Placeholder = WifiNamePlaceholder,
Margin = new Thickness(0, 0, 10, 0),
FontFamily = Fonts.HelveticaNeueBold,
FontSize = labelSize
}
//Attempt to set new value here but get error
//Doing this in hopes it can save their entry for next time.
wifi_name.Placeholder == WifiNamePlaceholder;
If you have any suggestions it would be greatly appreciated! Thank you!
【问题讨论】:
标签: c# xamarin xamarin.forms