在 Xamarin.Forms 中更新关于 ViewCell 的视图
Updating View with respect to ViewCell in Xamarin.Forms
我有一个带有列表和标签的视图。
我只是在相应列表的 ViewCell 中放置了一个时间选择器。
我想知道如何将时间选择器的选定时间放入视图中显示的相应标签中。 !
我该怎么做?
如何根据 ViewCell
中的时间选择器更新 View
中的标签?
您可以在 ViewCell 中使用自定义元素,例如:
private ExtendedLabel ExtendedLabel
{
get
{
return (ExtendedLabel)Element;
}
}
目前,您可以访问 ExtendedLabel 的所有 public 属性,通过它您可以更改 ViewModel 状态并执行任何您想做的事情。
我们可以通过实现INotifyPropertyChange来改变ViewCell中picker对应的view update中的label。
参考:
https://developer.xamarin.com/api/type/System.ComponentModel.INotifyPropertyChanged/
类似的论坛 post:https://forums.xamarin.com/discussion/comment/154124
我有一个带有列表和标签的视图。
我只是在相应列表的 ViewCell 中放置了一个时间选择器。
我想知道如何将时间选择器的选定时间放入视图中显示的相应标签中。 !
我该怎么做?
如何根据 ViewCell
中的时间选择器更新 View
中的标签?
您可以在 ViewCell 中使用自定义元素,例如:
private ExtendedLabel ExtendedLabel
{
get
{
return (ExtendedLabel)Element;
}
}
目前,您可以访问 ExtendedLabel 的所有 public 属性,通过它您可以更改 ViewModel 状态并执行任何您想做的事情。
我们可以通过实现INotifyPropertyChange来改变ViewCell中picker对应的view update中的label。
参考:
https://developer.xamarin.com/api/type/System.ComponentModel.INotifyPropertyChanged/
类似的论坛 post:https://forums.xamarin.com/discussion/comment/154124