ListBox Double click in WPF

 

 

 

 

 

 

 

 

ListBox ctlList = sender as ListBox

;

 

 

UIElement elem = ( UIElement ) ctlList . InputHitTest ( e . GetPosition ( ctlList

) );

 

 

while ( elem != ctlList

)

{

 

 

if ( elem is ListBoxItem

)

{

 

 

rd = (( ListBoxItem ) elem ). Content as Record ;

// Handle the double click here

 

 

break

;

}

 

 

elem = ( UIElement ) VisualTreeHelper . GetParent ( elem

);

你可能感兴趣的:(WPF)