I have a WPF list box that contains many items so a scroll bar is shown. I want to add even handler for the user hitting the items but not the scroll bar. How can I do this?
You can use the ItemContainerStyle
to set a handler for the click event on the items using EventSetter
<ListBox>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<EventSetter Event="Click" Handler="myHandler"/>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>