Guys I need a datagridview on a WPF page.
I used this
public WindowsFormsHost HOST = new WindowsFormsHost();
Then instanttiated my datagridview as
System.Windows.Forms.DataGridView gridview = new System.Windows.Forms.DataGridView();
Then using a datatable I filled the datagrid view as
//making the native control known to the WPF application
HOST.Child = gridview;
//Displaying the column headers (from datatable).
gridview.DataSource = table.DefaultView;
However when I add the gridview to my WPF window as
this.Children.Add(gridview); //error at this line
I get an error saying
cannot convert from 'System.Windows.Forms.DataGridView' to 'System.Windows.UIElement
Why so ?
You should add 'HOST' to WPF Window rather than adding 'gridview'.