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 Mike,
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. } }
I'll try this and get back to you.
Thank you very much.
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.
Rob,
Finally figured out where and how to get this working and now I'm getting a mouse enter event, so thank you for that.
Now that I am there, my issue is that all I have is an image, and I was hoping that the control would work somewhat like a grid in that if you know what the row is you can grab a value from a cell in that row. Is it possible for me to add a column to the dropdown and make it invisible and then when the mouse enter event fires know what the row is that is housing the ImageComboColumn?
Thanks again for all of your help.
You're very welcome. Glad we could get this resolved for you.
Rob, yes this is all working now, thank you very much for all of your help.
Thanks you very much for your help on this. I'll look at this later and get back to you.
You can get the row for the cell you moused over by using the ComboCellControl's Cell property. Each cell knows about the row it belongs to and each row knows about the data it represents in the grid. The code you should use in your MouseEnter/MouseLeave event should be:
object rowData = (sender as ComboCellControl).Cell.Row.Data;
The Data property in the row will be your underlying data object so you can access any of your custom properties from there.