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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:48:26+00:00 2026-06-16T16:48:26+00:00

I have a ComboBox, bound to a list of objects. I can get the

  • 0

I have a ComboBox, bound to a list of objects. I can get the objects to fill the drop down just fine. I am trying to set the background color for each object in the items list of the dropdown. I can set any color for all of them easily in the below style code.

What I want to do is Bind the Background Color Value to the KeyColorValue field of my Key object.

Here is my XAML:

              DisplayMemberPath="Name" 
              HorizontalAlignment="Left" 
              Margin="300,103,0,0" 
              VerticalAlignment="Top"
              Width="186" 
              SelectionChanged="roleBoundSelector_SelectionChanged" >
        <ComboBox.ItemContainerStyle>
            <Style TargetType="ComboBoxItem">
                <Setter Property="Background"
                Value = "{Binding Path=KeyColorValue}" />    

(If I put a color in here it works just fine…need to bind to the KeyColorValue of the MyKeys Object.)

  • 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-16T16:48:27+00:00Added an answer on June 16, 2026 at 4:48 pm

    Try this inside your style:

    <Setter Property="Background">
        <Setter.Value>
            <Binding RelativeSource="{RelativeSource Self}" Path="DataContext.KeyColorValue"/>
        </Setter.Value>
    </Setter>
    

    The DataContext of each ComboBoxItem is an object contained in the List that is feeding the ItemsSource of the ComboBox.

    Let me know if this was of any help, regards!

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

Sidebar

Related Questions

I have a ComboBox with a list of objects bound to it. Currently i
I have a WinForms combobox that is bound to a list of objects list
I have a ComboBox bound to a collection of objects defined as this. public
i have combobox in datagrid (sourse in mysql (web)) how i can get value
I have a problem with a list, which is bound to a ComboBox .
I have editable combobox where not always the preferred item is in the drop-down
I have a WPF ComboBox bound to a Collection List<Users> . I have applied
I have a comboBox that is bound to a list of strings from my
I have a WPF combobox bound to a list of items with long descriptions.
I have a combobox that I bind to a list of objects with three

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.