using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Media;
using System.Windows.Shapes;

namespace HostingWindowsFormsControl
{
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Utwórz element bazowy oraz kontrolkę PropertyGrid
            System.Windows.Forms.Integration.WindowsFormsHost host =
                new System.Windows.Forms.Integration.WindowsFormsHost();
            System.Windows.Forms.PropertyGrid propertyGrid =
                new System.Windows.Forms.PropertyGrid();

            // Dodaj kontrolkę PropertyGrid do elementu bazowego, a element bazowy do kontrolki WPF Grid
            host.Child = propertyGrid;
            grid.Children.Add(host);

            // Nadaj wartość specyficzną dla PropertyGrid
            propertyGrid.SelectedObject = this;
        }
    }
}