Gets or sets the format pattern to apply to the content of the column header. Gets or sets the content of the column header. Gets or sets the style that is used when rendering the element that the column displays for a cell that is not in editing mode. Gets or sets the style that is used when rendering the element that the column displays for a cell in editing mode. Gets or sets the style object to apply to the column header during a drag operation. Gets or sets a path to a value on the source object to provide the visual representation of the object. Gets or sets the display position of the column relative to the other columns in the DataGrid. Gets the Dispatcher this DispatcherObject is associated with. Gets the DependencyObjectType that wraps the CLR type of this instance. Gets the default value of the ElementStyle. Gets the default value of the EditingElementStyle property. Gets the DataGrid control that contains this column. Gets or sets the binding object to use when getting or setting cell content for the clipboard. Gets or sets the style that is used to render cells in the column. Gets or sets a value that indicates whether the user can sort the column by clicking the column header. Gets or sets a value that indicates whether the user can adjust the column width by using the mouse. Gets or sets a value that indicates whether the user can change the column display position by dragging the column header. Gets the current width of the column, in device-independent units (1/96th inch per unit). Identifies the SelectedValuePath dependency property. Identifies the ItemsSource dependency property. Identifies the ElementStyle dependency property. Identifies the EditingElementStyle dependency property. Identifies the DisplayMemberPath dependency property. Initializes a new instance of the DataGridComboBoxColumn class. If you want to use other controls in your DataGrid, you can create your own column types by using DataGridTemplateColumn. If you want to display other types of data, DataGrid provides the following column types: Column Type When the IsReadOnly property is set to true, users cannot edit the column and they will not be able to see the drop-down list. Sets the binding path to the value of the selected item specified by the SelectedValuePath property. Sets the binding path of the object that is currently selected. Sets the binding path of the text for the currently selected item. You can set the binding by using one of the following properties: Property Once the ItemsSource is set, bind the selected item in the ComboBox to the data item for the row that the cell is in. For more information, see x:Static Markup Extension.Īn inline collection of ComboBoxItem types.
For more information, see StaticResource Markup Extension.Īn x:Static code entity. To populate the drop-down list, first set the ItemsSource property for the ComboBox by using one of the following options:Ī static resource. The following illustration shows a DataGridComboBoxColumn.
DataGridComboBoxColumn allows users to select an item from a drop-down list. Use DataGridComboBoxColumn to display data where there is a set of items to choose from, such as an enumeration. 'GetData() creates a collection of Customer data from a databaseĭim custdata As ObservableCollection(Of Customer) = GetData() ' Add any initialization after the InitializeComponent() call.
' This call is required by the Windows Form Designer. ObservableCollection custdata = GetData() GetData() creates a collection of Customer data from a database Public partial class Window1 : NavigationWindow The selected item in the drop-down list is bound by setting the SelectedItemBinding property to the property of the object displayed in each row.
The following example shows how to populate the drop-down list for each ComboBox in the column with the values of an enumeration. DataGridColumn DataGridComboBoxColumn Examples