简体   繁体   中英

Updating View with respect to ViewCell in Xamarin.Forms

I have a view with a list and a label.

I just placed a time picker inside the ViewCell of the corresponding list.

I want to know how can i get the selected time of the time picker into the corresponding label present in the view. !

How can i do it?

How can i update the label inside the View with respect to the time picker present in the ViewCell ?

We can do it with the help of implementing INotifyPropertyChange to change the label in view update corresponding to picker in ViewCell.

Refer :

https://developer.xamarin.com/api/type/System.ComponentModel.INotifyPropertyChanged/

https://developer.xamarin.com/guides/cross-platform/xamarin-forms/user-interface/xaml-basics/data_bindings_to_mvvm/

Similar forum post : https://forums.xamarin.com/discussion/comment/154124

You can use your custom element inside ViewCell, for example:

private ExtendedLabel ExtendedLabel
{
    get
    {
        return (ExtendedLabel)Element;
    }
}

Currently, you have an access to all public properties for your ExtendedLabel and through it you can change ViewModel state and do anything you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM