Round Corner WPF Combobox

Kailash Chandra Behera | Saturday, January 28, 2017


Round Corner WPF Combobox is a custom WPF ComoboBox built using XAML code. It represents a selection control with a drop-down list in round corner pane that can be shown or hidden by clicking the arrow on the control.

This blog provides XAML to customize the button, the textbox and pate exist in the Combobox to make its corner round in WPF.

Round Corner WPF Combobox

wpf Combobox rounded corners

Round Corner WPF Combobox

Getting Started

The main elements of a WPF Combobox are a TextBox, a Button and a panel control. The TextBox in WPF Combobox is used to display the selected item text. The Button is used to open or close the drop down pane of Combobox.

The Panel actually contains the list of items of WPF Combobox, by default it hides it's contents(Combobox Items) and displays when the Combobox button clicks for second time.

Here This blog provides code in XAML to customize the Combobox button, Combobox textbox separately and uses toghter in Combobox style to make Combobox round corner.

Round Corner WPF Combobox

Code Examples

The below XAML codes declare style for Combobox button, it makes the Combobox button roundable corner by customermize the ControlTemplate of button control. Inside the button control a border is declared that actually makes the button control roundable corner.

The CornerRadius property of Border control makes border rounded, here the CornerRadius set 0,5,5,0 which make border right upper corner and right button corner round.

Style for Combobox button

  <Style x:Key="ComboboxButtonStyle" TargetType="{x:Type ToggleButton}">  
       <Setter Property="Template">  
           <ControlTemplate TargetType="{x:Type ToggleButton}">  
               <ContentPresenter />  

Round Corner WPF Combobox

The below XAML code constomzes the TextBox control of Combobox. As like button control, here also customized the ControlTemplate of TextBox and declared the border to make the TextBox roundable.

The CornerRadius property of border control is 5,0,0,5, means the top left corner and the button left corner of TextBox is made roundable because the button has top right corner and buttom right corner round.

Style for WPF Combobox TextBox

  <Style x:Key="ComboboxTextBoxStyle" TargetType="{x:Type TextBox}">  
       <Setter Property="Template">  
           <ControlTemplate TargetType="{x:Type TextBox}">  
               <Border CornerRadius="5,0,0,5"  
               Background="{TemplateBinding Background}"  
                 <ScrollViewer x:Name="PART_ContentHost"/>  

Round Corner WPF Combobox

This XAML codes customized the WPF Combobox and the DropDown panel to mathe WPF Combobox as Round Corner WPF Combobox. Inside the ControlTemplate of Combobox a Grid is declared to provide the proper position to TextBox, Button and DropDown panel. Inside the Grid XALML codes are written for calling Textbox style and Button Style.

Style for Combobox

 <Style x:Key="ComboboxStyle" TargetType="{x:Type Combobox}">  
       <Setter Property="HorizontalContentAlignment" Value="Center"/>  
       <Setter Property="VerticalContentAlignment" Value="Center"/>  
       <Setter Property="Template">  
           <ControlTemplate TargetType="{x:Type Combobox}">  
                 <ColumnDefinition MaxWidth="18"/>  
               <TextBox Name="PART_EditableTextBox"  
                Style="{StaticResource ComboboxTextBoxStyle}"  
                Height="{TemplateBinding Height}"/>  
               <ToggleButton Grid.Column="1" Margin="0"  
               Height="{TemplateBinding Height}"  
               Style="{StaticResource ComboboxButtonStyle}"  
               IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"  
                 <Path Grid.Column="1"  
                  Data="M 0 0 L 4 4 L 8 0 Z"  
                  Fill="DodgerBlue" />  
               <ContentPresenter Name="ContentSite"  
               Content="{TemplateBinding SelectionBoxItem}"  
               ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"  
               ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"  
               <Popup Name="Popup"  
               IsOpen="{TemplateBinding IsDropDownOpen}"  
                 <Grid Name="DropDown"  
                 MinWidth="{TemplateBinding ActualWidth}"  
                 MaxHeight="{TemplateBinding MaxDropDownHeight}">  
                   <ScrollViewer Margin="4,6,4,6" SnapsToDevicePixels="True">  
                     <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />  

Round Corner WPF Combobox

Use style in Combobox

 <Combobox Width="100" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="208,66,0,0" Height="25" Style="{StaticResource ComboboxStyle}">  

Related Articles

  1. Data Validation in WPF
  2. WPF Round Corner Button with click effects
  3. Round Corner PasswordBox in WPF
  4. Round Corner TextBox in WPF
  5. WPF Custom Datagrid Control(Filterable)
  6. WPF Round Corner ListBox
  7. Custom RadioButtonListBox With Image
  8. RadiobuttonList in WPF
  9. Custom CheckedListBox in WPF


In this blog Round Corner WPF Combobox, we saw how to create round corner Combobox in WPF,by customizing the Combobox Textbox, Toggle button and dropdown panel. Here we also discussed how to apply style in Combobox, TextBox and Button control. I hope you have enjoyed it a lot.