private void WpfPropertyPage_Load(object sender, EventArgs e) { SuspendLayout(); _host = new PropertyPageElementHost { AutoSize = false, Dock = DockStyle.Fill }; if (_control == null) { _control = CreatePropertyPageControl(); } var 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 += OnControlStatusChanged; }
protected async override Task OnSetObjects(bool isClosing) { if (isClosing) { _control.DetachViewModel(); return; } else { //viewModel can be non-null when the configuration is chaged. if (_control == null) { _control = CreatePropertyPageControl(); } } _viewModel = CreatePropertyPageViewModel(); _viewModel.Project = UnconfiguredProject; await _viewModel.Initialize().ConfigureAwait(false); _control.InitializePropertyPage(_viewModel); }
private void WpfPropertyPage_Load(object sender, EventArgs e) { SuspendLayout(); _host = new PropertyPageElementHost { AutoSize = false, Dock = DockStyle.Fill }; if (_control == null) { _control = CreatePropertyPageControl(); } var viewer = new ScrollViewer { VerticalScrollBarVisibility = ScrollBarVisibility.Auto, HorizontalScrollBarVisibility = ScrollBarVisibility.Auto }; // Capture original WPF font var originalFontFamily = viewer.FontFamily; var originalFontSize = viewer.FontSize; viewer.Content = _control; _host.Child = viewer; // Parenting viewer to ElementHost removes its default font, // So we restore the font here. viewer.FontFamily = originalFontFamily; viewer.FontSize = originalFontSize; wpfHostPanel.Dock = DockStyle.Fill; wpfHostPanel.Controls.Add(_host); ResumeLayout(true); _control.StatusChanged += OnControlStatusChanged; }