Example #1
0
        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;
        }
Example #2
0
        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;
        }