Search code examples
wpfwpf-controlswpfdatagrid

Enable datagridview in vs2012?


How do I enable DataGridView?

Currently it is greyed out in the toolbox, see this screenshot.


Solution

  • DataGridView is a Windows Forms control, as your screenshot shows. Putting WinForms in WPF is usually avoided where possible as they are different technologies - you should aim to use a WPF equivalent.

    If you really want to use it, you can use a WindowsFormsHost - there are lots of guides out there to explain how.


    In fact, DataGrid is the WPF equivalent of DataGridView, e.g. WPF DataGrid Vs Windows Forms DataGridView. I'd use DataGrid if I were using WPF.