我已经创建了一个商店列表,并将其添加到一个选择器中,但从视图中无法加载。它显示的是一个没有项目的选择器。
ViewModel代码如下
public List<string> Stores = new List<string>
{
"store 1",
"store 2",
"store 3"
};
private int _selectedStoreIndex = -1;
public int SelectedStoreIndex
{
get { return _selectedStoreIndex; }
set
{
if (_selectedStoreIndex != value)
{
_selectedStoreIndex = value;
UpdateStoreSelection();
OnPropertyChanged();
}
}
}
XAML文件
<Picker ItemsSource="{Binding Stores}" SelectedIndex="{Binding SelectedStoreIndex}"/>
3条答案
按热度按时间hpxqektj1#
当冷启动时,
OnStart
中的OnStart
方法被调用。然后你可以使用Secure Storage/Preference在每个平台的本地存储中保存一个密钥,然后只使用DateTime。现在只计算差值。当应用被销毁并重新启动时,OnStart
将被再次调用,只重置密钥。kpbpu0082#
您只需要获取进程的开始时间和当前时间。
mpbci0fu3#
我已经修复了从ViewModel更新数据的问题