Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3803002
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:17:43+00:00 2026-05-19T14:17:43+00:00

I have a DataGrid containing some DataGridComboBoxColumns. I would like the comboBoxes inside those

  • 0

I have a DataGrid containing some DataGridComboBoxColumns.

I would like the comboBoxes inside those columns to have a certain style applied.

so I tried adding the following to my DataGrid’s Resources:

<Style x:Key="{x:Type ComboBox}" TargetType="{x:Type ComboBox}">
    <Setter Property="SnapsToDevicePixels" Value="true"/>
    <Setter Property="OverridesDefaultStyle" Value="true"/>
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
    <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
    <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>

    <Setter Property="Background" Value="{StaticResource DefaultBackgroundBrush}"/>
    <Setter Property="BorderBrush" Value="{StaticResource DefaultBorderBrush}"/>
    <Setter Property="Foreground" Value="{StaticResource DefaultForegroundBrush}"/>
    <Setter Property="FontFamily" Value="{StaticResource DefaultFontFamily}"/>
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}"/>
    <Setter Property="Padding" Value="2"/>
</Style>

does not do anything at all.

amazingly enough, if I add:

<Style x:Key="{x:Type ComboBoxItem}" TargetType="ComboBoxItem">
    <Setter Property="SnapsToDevicePixels" Value="true"/>
    <Setter Property="OverridesDefaultStyle" Value="true"/>
    <Setter Property="Foreground" Value="Red"/>
</Style>

the comboBoxItems inside the same comboBoxes will get the red foreground color Correctly.

so basically, I cannot set the style of the comboBoxes inside my dataGrid, but I can set the style of the comboBoxItems inside those same comboBoxes.

quite surprising…

does anyone have a clue about what’s going on here and how I can solve my problem?

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T14:17:44+00:00Added an answer on May 19, 2026 at 2:17 pm

    What exactly is this supposed to do? x:Key="{x:Type ComboBox}"

    You should not assign keys if you want styles to be applied to all controls in the subtree.

    Edit: To apply the styles to the ComboBoxes you must adjust the properties DataGridComboBoxCotlumn.ElementStyle and DataGridComboBoxColumn.EditingElementStyle.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Silverlight app with a DataGrid containing some custom columns and all
I have a DataGrid where each column has a SortExpression. I would like the
I have a WPF DataGrid with several Templated Columns containing Checkboxes. If I press
I have a DataGrid with 5 template columns, However when I try and add
I have a DataGrid containing a small table. Until now, I had a double
I have datagrid with list of MyPlayer objects linked to ItemsSource, there are ComboBoxes
I have MainWindow containing a datagrid and a filter panel. The filter panel can
I'm working on creating a datagrid that has a checkbox column. I have some
I have a DataGrid that looks like this (slightly simplified here): <asp:DataGrid ID=grdQuotas runat=server
I've got a datagrid containing part objects, consisting of a handful of template columns.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.