Skip to content

How to change the default style of DataGridComboBoxColumn? #3019

Closed Answered by nicolaihenriksen
Diyari-Kurdi asked this question in Q&A
Discussion options

You must be logged in to vote

@Diyari-Kurdi When you let the DataGrid auto-generate columns rather than explicitly defining them in XAML, you're effectively cutting specialized MDIX columns out of the loop. However, there is still a hook you can use to obtain what I believe you're going for.

My assumption from your sample is that the underlying data source for the "Continents" column is an enum. If so, you can attach the hook to your data grid like this:

<DataGrid AutoGenerateColumns="True"
          AutoGeneratingColumn="DataGrid_OnAutoGeneratingColumn"
          ... />

Then in your code-behind you can implement the hook in a manner like this:

private void DataGrid_OnAutoGeneratingColumn(object sender, DataGridAutoGe…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Diyari-Kurdi
Comment options

@nicolaihenriksen
Comment options

@Keboo
Comment options

Answer selected by Diyari-Kurdi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants