Search code examples
c#wpfnamespaceswpfdatagriddatagridcomboboxcolumn

What namespace must be used to get a DataGridComboBoxColumn?


I am writing an app in C# 3.5 in WPF. I want to programmatically add a DataGridComboBoxColumn in C# to a WPF toolkit DataGrid. The problem is that the control itself seems to not exist because I am missing either a directive or an assembly. I thought that System.Windows.Controls and by adding a reference to the WPFToolkit would handle this but it seems to not be... Am I missing something?

What I find odd is that in XAML there is no problem at all to create a DataGridComboBoxColumn...

Here is an example of what I am trying to accomplish:

SomeDataGrid.Columns.Add(new DataGridComboBoxColumn()
{
    Header="ColumnHeader", 
    //...
});

*Edit: By understanding a bit more my problem... I want to know also how you can do the equivalent XAML in C#:

<Window xmlns:WPFToolkit="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit">
</Window>

Solution

  • Assembly WpfToolkit, namespace: Microsoft.Windows.Controls.