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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:20:01+00:00 2026-06-17T09:20:01+00:00

I am having an issue with getting a custom property set with a combobox.

  • 0

I am having an issue with getting a custom property set with a combobox. I am using .Net 4.0, WPF with xaml resources for types set in a dictionary and some brushes set in the app.xaml. I can get the nice rounded corner just find and a gradient and layout to my combobox using the surrounding ‘border’ trick. However I can’t seem to get the ‘Selected Item’ in the combobox to have a background other than dull gray. I would prefer to change it to transparent and inherit the gradient of the parent border. However I am missing the property or relationship to do this.

Does anyone know how to do this in the xaml?

Image:

Combobox Current showings of Selections and selected

code:

Dictionary item:

  <Style TargetType="{x:Type Border}">
        <Setter Property="Background" Value="{StaticResource MoneyBrush}" />
        <Setter Property="BorderBrush" Value="#071C07" />
    <Setter Property="BorderThickness" Value="3" />
    <Setter Property="CornerRadius" Value="20" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
  </Style>

Brush in main App.xaml:

<LinearGradientBrush x:Key="MoneyBrush" EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="#3A883A" Offset="1" />
            <GradientStop Color="#FFFFFF" Offset="0" />
            <GradientStop Color="#FF53AA75" Offset="0.50" />
            <GradientStop Color="#073307" Offset="0.95" />
        </LinearGradientBrush>
<LinearGradientBrush x:Key="FontBrush" EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="Black" Offset="0" />
            <GradientStop Color="#107810" Offset="0.50" />
            <GradientStop Color="Black" Offset="0.65" />
        </LinearGradientBrush>

Actual item in mainwindow:

<Border Margin="5" >
                    <ComboBox Height="30" Width="170" Margin="10" x:Name="combopersons" 
                    FontSize="20"
                    ItemsSource="{Binding Path=People}"
                    DisplayMemberPath="FirstName"
                    SelectedValuePath="PersonId"
                    SelectedValue="{Binding Path=CurrentUser}"
                    Foreground="{StaticResource FontBrush}">
                    </ComboBox>
                </Border>

EDIT >>>

I like the solution proposed by @iltzortz, but I wanted a gradient so in this case this would work better:

<ComboBox.Resources>
    <LinearGradientBrush x:Key="{x:Static SystemColors.WindowBrushKey}" >
        <GradientStop Color="#3A883A" Offset="1" />
        <GradientStop Color="#FFFFFF" Offset="0" />
        <GradientStop Color="#FF53AA75" Offset="0.50" />
        <GradientStop Color="#073307" Offset="0.95" />
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" >
        <GradientStop Color="#000000" Offset="1" />
        <GradientStop Color="#FFFFFF" Offset="0" />
    </LinearGradientBrush>
</ComboBox.Resources>

EDIT 2 >>>

For some reason this will only work on applications I have built using .NET 4.0 or higher on Visual Studio 2012 with Windows 7. When I try to run the code at home for some reason
it won’t render I believe this is due to either Windows 8 or Visual Studio 2010 interpreting different colors for different system values. Be aware of this if you have Windows 8 or Visual Studio 2010 as it will work for me for one environment but not the other… curious.

  • 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-17T09:20:02+00:00Added an answer on June 17, 2026 at 9:20 am

    The following code seems to do the job

    <Grid Background="Pink">
    
        <ComboBox Margin="10,0" Width="100" Height="40">
            <ComboBoxItem>1</ComboBoxItem>
            <ComboBoxItem>2</ComboBoxItem>            
            <ComboBoxItem>3</ComboBoxItem>
            <ComboBox.Resources>
                <SolidColorBrush x:Key="{x:Static SystemColors.WindowBrushKey}" Color="Green" />
                <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Green" />
            </ComboBox.Resources>            
        </ComboBox>
    
        <TextBox VerticalAlignment="Top" Margin="10"/>
    </Grid>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having an issue getting some code to work. Is there a way to
I'm having an issue getting Appstats to work correctly. Using /appstats or /appstats/stats ends
I'm having a little issue with getting a value of field in HTML using
I am having an issue with drawing custom tiles over Google maps. Using GoogleTileOverlay
I seem to be having an issue delegating a custom event to a set
I am having great success getting the look I want using a custom header
I'm having some issue getting what seems like a fairly straight-forward problem solved in
I'm having an issue getting a LINQ query to work. I have this XML:
I'm having an issue getting files loaded into an app called GCS, by dragging
I'm having an issue getting this CSS for a sprite sheet to work on

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.