I need to know when a user mouses over the image column in a row so that I can present a larger popup with a bigger image and more details.
What would my approach be to accomplish this?
Thank you,
Mike
Hi Rob, if I could get a little more help from you on this issue.
I placed the style within the Grid.Resources tag of my user control, and the handler in my C# code. However, the OnMouseEnterHandler never fires for any of the Multi-combos. Is there something that I missed? Here is my xaml code:
<ig:XamMultiColumnComboEditor x:Key="MouseEnterHandlerStyle"> <ig:XamMultiColumnComboEditor.Resources> <Style TargetType="{x:Type ig:ComboCellControl}"> <EventSetter Event="MouseEnter" Handler="OnMouseEnterHandler" /> </Style> </ig:XamMultiColumnComboEditor.Resources> </ig:XamMultiColumnComboEditor> <ig:XamMultiColumnComboEditor x:Key="MouseLeaveHandlerStyle"> <ig:XamMultiColumnComboEditor.Resources> <Style TargetType="{x:Type ig:ComboCellControl}"> <EventSetter Event="MouseLeave" Handler="OnMouseLeaveHandler" /> </Style> </ig:XamMultiColumnComboEditor.Resources> </ig:XamMultiColumnComboEditor>
Here is my C# code:
void OnMouseEnterHandler( object sender, System.Windows.Input.MouseEventArgs e ) { if( ( sender as ComboCellControl ).Content is Image ) { // popup logic here. MessageBox.Show( "Show Popup Here" ); } } void OnMouseLeaveHandler( object sender, System.Windows.Input.MouseEventArgs e ) { if( ( sender as ComboCellControl ).Content is Image ) { // popup logic here. //MessageBox.Show( "Show Popup Here" ); } }
Any thoughts?
Thanks.
Hi Mike,
I want to make a correction to my last update. Instead of checking the cell control's content you should instead check the cell's column directly to see if it's an ImageComboColumn. The code would get switched to the following:
void OnMouseEnterHandler(object sender, MouseEventArgs e) { if ((sender as ComboCellControl).Cell.Column is ImageComboColumn) { // popup logic here. } }
I'll try this and get back to you.
Thank you very much.
The approach I would use is through a style event setter for the ComboCellControl. You would create a style that targets ComboCellControl and add an EventSetter to handle the MouseEnter event. Then inside the event, you can check the Content of the ComboCellControl for whether its an Image or not. If its an Image then you can perform your logic for displaying a larger popup. The code would look something like the following.
<ig:XamMultiColumnComboEditor> <ig:XamMultiColumnComboEditor.Resources> <Style TargetType="{x:Type ig:ComboCellControl}"> <EventSetter Event="MouseEnter" Handler="OnMouseEnterHandler"/> </Style> </ig:XamMultiColumnComboEditor.Resources> </ig:XamMultiColumnComboEditor>
void OnMouseEnterHandler(object sender, MouseEventArgs e) { if ((sender as ComboCellControl).Content is Image) { // popup logic here. } }