简体   繁体   中英

Bind View model to view

I have general question about binding in the view of the view model.

We are working on wizard and in the initialize page all the pages are called before the wizard starts (see the code below) so in the view we are using the following code to do the relation with this.Datacontext = mvm; , currently when this code is called the objects in the view model which bind to the screen (from the viewModel ) is empty since this called in the beginning of the pages creation but the view model will be updated with data later in the program.

Will the screen be updated with the data when the bounded items are filled?

 public partial class EPreviewGraphSelector : UserControl
        {
           MyViewModel mvm = new viewModel(); 
            public EPreviewGraphSelector()
            {
                InitializeComponent();
                this.Datacontext = mvm;
            }
        }

does the screen will be updated with the data when the bounded items is filled ?

Provided your ViewModel implements INotifyPropertyChanged correctly, the UI should update.

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