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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:56:25+00:00 2026-05-25T19:56:25+00:00

I have a ComboBox, bound to a DataTable. I’m trying to add an extra

  • 0

I have a ComboBox, bound to a DataTable. I’m trying to add an extra ComboBoxItem to the top of the list, where I can put a link to customize the list. Currently I am just inserting a dummy row to the top of my DataTable, and then using a DataTrigger on the ComboBox to make it appear correctly. However, I’m not quite getting the correct result.

I’ve tried two methods. In the first, my DataTrigger replaces the dummy item with a ControlTemplate, which contains a TextBlock.

<ComboBox IsEditable="True" Name="comboWell" ItemsSource="{Binding}" DisplayMemberPath="wellId">
    <ComboBox.ItemContainerStyle>
        <Style TargetType="{x:Type ComboBoxItem}">
            <Style.Triggers>
                <DataTrigger Binding="{Binding wellId}" Value="(settings)">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="ComboBoxItem">
                                <TextBlock Text="Customize..." />
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </ComboBox.ItemContainerStyle>
</ComboBox>

The result looks right, but there is no mouseover highlight on that item. The rest of the list works fine, but that one item doesn’t react at all when I mouse over it. I’ve tried adding extra triggers and styles to apply a mouseover effect, but I get no change.

The second method I tried was just to alter the appearance of the item rather than completely replace it with a ControlTemplate.

<ComboBox IsEditable="True" Name="comboWell" ItemsSource="{Binding}" DisplayMemberPath="wellId">
    <ComboBox.ItemContainerStyle>
        <Style TargetType="{x:Type ComboBoxItem}">
            <Style.Triggers>
                <DataTrigger Binding="{Binding wellId}" Value="(settings)">
                    <Setter Property="Content" Value="Customize..." />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </ComboBox.ItemContainerStyle>
</ComboBox>

This one functions like a regular list item, mouseover works fine. However, the item is blank. Neither the original text, nor the text I try to set in the DataTrigger, are there. No errors, just an empty list item.

Is there a better way to accomplish this?

  • 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-25T19:56:26+00:00Added an answer on May 25, 2026 at 7:56 pm

    Remove the DisplayMemberPath and add the default Content to the Style

    <ComboBox IsEditable="True" Name="comboWell" ItemsSource="{Binding }">
        <ComboBox.ItemContainerStyle>
            <Style TargetType="{x:Type ComboBoxItem}">
                <Setter Property="Content" Value="{Binding wellId}" />
                <Style.Triggers>
                    <DataTrigger Binding="{Binding wellId}" Value="(settings)">
                        <Setter Property="Content" Value="Customize..." />
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </ComboBox.ItemContainerStyle>
    </ComboBox>
    

    DisplayMemberPath is actually a shortcut way of saying the item template should just be a TextBlock with it’s Text bound to the DisplayMemberPath item, and I am guessing it was overwritting whatever you had in the Style.

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

Sidebar

Related Questions

I have a combobox on my form that is bound to a generic list
I have a ComboBox with a list of objects bound to it. Currently i
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 combobox which is bound to a datatable column like this: ComboBox.DataContext
I have a combobox bound to a collection, so the user can select one
I have a WPF combobox bound to a list of items with long descriptions.
I have a ComboBox that has its ItemsSource bound to a static List<CustomSettings> of
I have a ComboBox bound to an ObservableCollection of decimals. What is the correct
I have a combobox bound to a database table. When the user inserts a

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.