【发布时间】:2015-12-17 22:12:14
【问题描述】:
我有一个带有列表和标签的视图。
我只是在对应列表的 ViewCell 中放置了一个时间选择器。
我想知道如何将时间选择器的选定时间放入视图中存在的相应标签中。 !
我该怎么做?
如何根据ViewCell 中的时间选择器更新View 中的标签?
【问题讨论】:
标签: listview view xamarin xamarin.forms
我有一个带有列表和标签的视图。
我只是在对应列表的 ViewCell 中放置了一个时间选择器。
我想知道如何将时间选择器的选定时间放入视图中存在的相应标签中。 !
我该怎么做?
如何根据ViewCell 中的时间选择器更新View 中的标签?
【问题讨论】:
标签: listview view xamarin xamarin.forms
我们可以通过实现 INotifyPropertyChange 来改变 ViewCell 中选择器对应的视图更新中的标签。
参考:
https://developer.xamarin.com/api/type/System.ComponentModel.INotifyPropertyChanged/
【讨论】:
您可以在 ViewCell 中使用您的自定义元素,例如:
private ExtendedLabel ExtendedLabel
{
get
{
return (ExtendedLabel)Element;
}
}
目前,您可以访问 ExtendedLabel 的所有公共属性,通过它您可以更改 ViewModel 状态并做任何您想做的事情。
【讨论】: