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 8457783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:53:58+00:00 2026-06-10T12:53:58+00:00

I have two ComboBoxes . One is bound to a list of enum values,

  • 0

I have two ComboBoxes. One is bound to a list of enum values, while the other is bound to a list of custom class objects and has the DisplayMemberPath property set.

The ComboBox bound to the enum values applies an implicit TextBlock style, while the ComboBox that uses the DisplayMemberPath property does not.

Using Snoop I can verify that both ComboBoxes are rendered with the exact same set of controls (a <ContentPresenter> containing a <TextBlock>), however the TextBlock in the ComboBox without the DisplayMemberPath set contains a Margin of 5 while the one with DisplayMemberPath set does not.

<Grid.Resources>
    <Style TargetType="{x:Type TextBlock}">
        <Setter Property="Margin" Value="5" />
    </Style>
</Grid.Resources>

<ComboBox Grid.Row="0" Grid.Column="1" 
          ItemsSource="{Binding EnumCollection}" 
          SelectedItem="{Binding SelectedEnum}" />

<ComboBox Grid.Column="1" Grid.Row="2" 
          ItemsSource="{Binding SomeCollection}" 
          SelectedItem="{Binding SelectedItem}"
          DisplayMemberPath="Name" />

Screenshot

Why is this? And what can I do to stop the Enum ComboBox from inheriting the implicit TextBlock style?

  • 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-06-10T12:53:59+00:00Added an answer on June 10, 2026 at 12:53 pm

    My assumption would be that the DisplayMemberPath creates a DataTemplate, and styles will not be applied within its scope.

    Try setting DisplayMemberPath="." to make the first ComboBox use a DataTemplate containing <TextBlock Text="{Binding .}">, which will prevent the implicit style from getting applied.

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

Sidebar

Related Questions

I have two comboboxes; one contains a list of countries, and the other contains
I have two comboboxes on an form. Each has the values Yes and No.
I have two classes (MVC view model) which inherits from one abstract base class.
I have two comboBoxes, one that lists the 7 days of the week and
I have two combo boxes, one for 'order by' and the other 'direction' (ascending,
I have a form with two ComboBoxes. The second ComboBox holds a list of
I currently have two comboboxes on a form. The first combobox contains a list
Suppose I have two comboboxes. One for the lower-value and one for the upper
How can I add two comboboxes from one store store have type field witch
I have created two comboboxes, one for the min value and one for the

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.