What namespace must be used to get a DataGridComboBoxColumn?
-
18-09-2019 - |
Question
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.
OTHER TIPS
In VS 2005 the following show in the example on page 300 of "Programming Microsoft Windows Forms - Charles Petzold - Microsoft Press"
using System;
using System.Drawing;
using System.Windows.Forms;
Edwin