Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting properties of auto-generated listboxitem

Tags:

wpf

listbox

I am trying to set the inputbindings of the auto-generated ListBoxItems of a databound ListBox. The code below does not work. The compiler complains that "The Property Setter 'InputBindings' cannot be set because it does not have an accessible set accessor." What is the correct syntax to set the InputBindings?

    <ListBox.ItemContainerStyle>
        <Style TargetType="{x:Type ListBoxItem}">
            <Setter Property="ListBoxItem.InputBindings">
                <Setter.Value>
                    <MouseBinding Command="{Binding OpenCommand}" Gesture="LeftDoubleClick"/>
                </Setter.Value>
            </Setter>
        </Style>
    </ListBox.ItemContainerStyle>

PS: Posting does not work with Opera 10.51

like image 854
DerKlaus Avatar asked Nov 23 '25 12:11

DerKlaus


1 Answers

This one is indeed tricky.

I found two proposed solutions for you, neither are very easy to implement I am afraid. I hope it works for you!

  • link one
  • Link two
like image 196
Dabblernl Avatar answered Nov 26 '25 07:11

Dabblernl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!