Have a clickable button on top of a combobox in WPF
        Posted  
        
            by Travyguy9
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Travyguy9
        
        
        
        Published on 2010-04-29T20:57:39Z
        Indexed on 
            2010/04/30
            14:37 UTC
        
        
        Read the original article
        Hit count: 233
        
I can get a button to appear and be clickable in the drop down list of a combo box, but I cannot get the selected combo box item (the drop list is closed) to have the button be clickable. It always skips the button click and just opens the drop down list. I basically want the Button_Click event handler that I setup to be called once it is clicked. Here is my sample combo box that shows the button but is not clickable once it is in the selected item:
<ComboBox x:Name="MyCombo" Width="200" Height="30" ItemsSource="{Binding ListCombo}">
        <ComboBox.Resources>
            <DataTemplate DataType="{x:Type local:ComboItemClass}">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{Binding Path=SampleText}" Width="120" />
                    <Button Width="20" Content="..." Click="Button_Click"/>
                </StackPanel>
            </DataTemplate>
        </ComboBox.Resources>
    </ComboBox>
© Stack Overflow or respective owner