private void WpfPropertyPage_Load(object sender, EventArgs e) { SuspendLayout(); _host = new PropertyPageElementHost(); _host.AutoSize = false; _host.Dock = DockStyle.Fill; if (_control == null) { _control = CreatePropertyPageControl(); } ScrollViewer viewer = new ScrollViewer { VerticalScrollBarVisibility = ScrollBarVisibility.Auto, HorizontalScrollBarVisibility = ScrollBarVisibility.Auto }; viewer.Content = _control; _host.Child = viewer; wpfHostPanel.Dock = DockStyle.Fill; wpfHostPanel.Controls.Add(_host); ResumeLayout(true); _control.StatusChanged += _control_OnControlStatusChanged; }
protected async override 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); }
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); }