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

  • Home
  • SEARCH
  • 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 4117510
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:50:38+00:00 2026-05-20T22:50:38+00:00

I want to extend the WPF Combobox in a way that two buttons are

  • 0

I want to extend the WPF Combobox in a way that two buttons are displayed next to the combobox. I cannot use a UserControl, because I need to specify the items of the combobox in pure xaml like this:

<CustomComboBox>
   <CustomComboBoxItem />
   <CustomComboBoxItem />
</CustomComboBox>

I’m quite scared to take the template of the combobox and extend it, because for comboboxes it is very large and complex. I’m looking for an easy and simple solution to create that kind of ComboBox-like ItemsControl with just two buttons attached to it. Suggestions welcome!

  • 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-20T22:50:38+00:00Added an answer on May 20, 2026 at 10:50 pm

    Edit: Conrete example using a UserControl:

    Xaml:

    <UserControl x:Class="Test.CustomComboBox"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                 mc:Ignorable="d" 
                 d:DesignHeight="300" d:DesignWidth="300">
        <StackPanel Orientation="Horizontal">
            <ComboBox Name="_comboBox" Margin="5"/>
            <Button Content="_Apply" Padding="3"  Margin="5" Click="Button_Apply_Click"/>
            <Button Content="_Reset" Padding="3"  Margin="5" Click="Button_Reset_Click"/>
        </StackPanel>
    </UserControl>
    

    Code:

    [ContentProperty("Items")]
    public partial class CustomComboBox : UserControl
    {
        public event RoutedEventHandler ApplyClick;
        public event RoutedEventHandler ResetClick;
    
        public ItemCollection Items
        {
            get { return _comboBox.Items; }
            set
            {
                _comboBox.Items.Clear();
                foreach (var item in value)
                {
                    _comboBox.Items.Add(item);
                }
            }
        }
    
        public CustomComboBox()
        {
            InitializeComponent();
        }
    
        private void Button_Apply_Click(object sender, RoutedEventArgs e)
        {
            if (ApplyClick != null)
            {
                ApplyClick(sender, e);
            }
        }
    
        private void Button_Reset_Click(object sender, RoutedEventArgs e)
        {
            if (ResetClick != null)
            {
                ResetClick(sender, e);
            }
        }
    }
    

    Usage:

     <local:CustomComboBox ApplyClick="Button2_Click">
         <ComboBoxItem Content="Item1"/>
         <ComboBoxItem Content="Item2"/>
         <ComboBoxItem Content="Item3"/>
     </local:CustomComboBox>
    

    Appearance:

    enter image description here


    A UserControl should do fine, you can still specify the items in Xaml markup, e.g. if i have a time user control i can do this:

    [ContentProperty("Hours")]
    public partial class TimeBox : UserControl
    {
        public string Hours
        {
            get { return this.TBHours.Text; }
            set { this.TBHours.Text = value; }
        }
    
        ...
    }
    

    That way you can set the hours in XAML:

            <local:TimeBox>
                <sys:String>24</sys:String>
            </local:TimeBox>
    

    You should be able to adapt this to set the items of your ComboBox.

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

Sidebar

Related Questions

I have a class that I want to extend the WPF Window class. I
I want to extend the IEnumerable class but only for types that can be
I want to extend the functionality of a part of a program that I'm
I have a class PlaylistTrack that I want to extend class Song. When I
I have a Django template that I want to extend in multiple places. In
I have a SVG file that I want to extend by adding onclick handlers
As I use Notepad++ daily at work, I want to extend it to be
i want extend an entity framework model with a temporany attribute. I need it
I want to extend the DataGrid component so that there is a (read-only) column
I want to use a RIA Services in WPF (Please hear me out before

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.