Click here to Skip to main content
15,943,008 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to Create a Customized Combobox by extending the WPF Combobox. I like to create a template for it
On the DropDown of the combobox it must have
1) Listview
2) Button
Help me to create that

I tried like this
Created a xaml file to create a template
<Style TargetType="ComboBoxItem" x:Name="CombowithList">
        <Setter Property="ContentTemplate">
                            <ListView x:Name="lvMainList" Width="400" Height="70">
                                        <GridViewColumn Header="Name" Width="150" DisplayMemberBinding="{Binding Name}"/>
                                        <GridViewColumn Header="Place" Width="150" DisplayMemberBinding="{Binding Place}"/>
                                        <GridViewColumn Header="ID" Width="100" DisplayMemberBinding="{Binding ID}"/>

And Created a class to access this style

public class GOGWPFFilterCombo : System.Windows.Controls.ComboBox
public GOGWPFFilterCombo()

this.ItemContainerStyle = this.FindResource("CombowithList") as System.Windows.Style;

            _dtToBind = new System.Data.DataTable();

            System.Data.DataRow dr = _dtToBind.NewRow();
            dr["Name"] = "James";
            dr["Place"] = "USA";
            dr["ID"] = "121";
            this.ItemsSource = _dtToBind.DefaultView;}

This is the Sample Code am trying; It is only on progress now
Updated 18-Jun-14 3:38am
agent_kruger 18-Jun-14 9:16am    
sir i cannot understand where is the problem?
joshrduncan2012 18-Jun-14 9:20am    
What is your question? Where are you stuck? Show us your code of your attempt to fulfill this requirement. Are you getting any errors? If so, what is the text of the error?

1 solution

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900