Setting properties of auto-generated listboxitem

Posted by DerKlaus on Stack Overflow See other posts from Stack Overflow or by DerKlaus
Published on 2010-04-03T18:34:39Z Indexed on 2010/04/03 19:43 UTC
Read the original article Hit count: 317

Filed under:
|

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

© Stack Overflow or respective owner

Related posts about wpf

Related posts about listbox