protected override async Task OnSetObjects(bool isClosing) { if (isClosing) { _control.DetachViewModel(); return; } else { //viewModel can be non-null when the configuration is changed. if (_control == null) { _control = CreatePropertyPageControl(); } } _viewModel = CreatePropertyPageViewModel(); await _viewModel.Initialize(); _control.InitializePropertyPage(_viewModel); }