Hi Greg,

Not 100% sure if its the same in Silverlight but I think this should work 

-> In wpf I use an ItemContainerStyle set on the ListBox.

e.g. <ListBox ItemContainerStyle="{StaticResource LocalItemContainerStyle}"/>

The Style then specifies the handler functions for various things

<Style x:Key="LocalItemContainerStyle" TargetType="{x:Type ListBoxItem}">
                <Style.Setters>
                    <EventSetter Event="FrameworkElement.Loaded" 
Handler="listItem_Loaded"/>
                    <EventSetter Event="MouseDoubleClick" 
Handler="listItem_DoubleClick"/>
                    <EventSetter Event="MouseLeftButtonUp" 
Handler="listItem_Selected"/>
                    <EventSetter Event="MouseRightButtonUp" 
Handler="listItem_RightClick"/>
                    <Setter Property="Margin" Value="2.5"/>
                    <Setter Property="Template" Value="{StaticResource 
TransparentListItemBorderTemplate}"/>
                </Style.Setters>
            </Style>

Good luck,
Dan.



From: Greg Keogh 
Sent: Monday, April 19, 2010 7:55 PM
To: 'ozSilverlight' 
Subject: Mouseclick in ListBox


Folks, I have a bound ListBox with a template that makes the items appear 
pretty with an icon and some text boxes.

 

I want to trap a mouse click anywhere in one of the list items. The mouse may 
of course click on one of the controls in the item's template. I'm not 
interested in where the mouse is clicked, I just want to know which item it's 
inside.

 

I've been playing with mouse click events and similar tricks, but no events are 
being raised. Am I missing some simple technique for this?

 

Thanks

Greg



--------------------------------------------------------------------------------


_______________________________________________
ozsilverlight mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
_______________________________________________
ozsilverlight mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight

Reply via email to