Hello,
I'm having a difficulty implementing custom row hover behaviour. The general idea is to disable hover effects for specific rows (based on data bound to row). So, I restyled the CellControl and used triggers instead of VisualStateManager states to provide effects.
However, one thing is working strangely. The IsMouseOver property is set to false as long as I hold the mouse button. This makes the row de-highlighted and causes a very nasty graphical glitch.
WPF Inspector says that all controls nested within XamGrid lose the IsMouseOver property, except the XamGrid itself. It, however, has its IsMouseCaptured property set to True.
Is it possible to somehow disable this odd logic and have the IsMouseOver property value maintained?
Thank you for your post. I have been looking into it and I created a sample project for you with the functionality you want. Basically I copied the default Style for the CellControl and removed a State that changes the Background of the Cell and added a MultiDataTrigger bound to the Row’s IsMouseOver Property and to the underlying object’s Property. Please let me know if you need further clarifications on this matter.
Looking forward for your reply.
The problem still exists in the sample application you have sent.
When I press the mouse button clicking on any row. the green selection disappears.
I managed to work around it in the very end, however I think it's a bug in XamGrid. This happens because XamGrid captures the mouse when user clicks on it. It's later uses for resizing columns and scrolling the rows. However, no mouse capture is required (I guess?) when you click on a cell. So I created the following handler in the constructor:
Mouse.AddGotMouseCaptureHandler(xamGrid1, (sender, args) => { if (!(sender is Thumb || sender is HeaderCellControl)) Mouse.Capture(null); } );
It doesn't let the selection disappear, but looks like an epic kludge. Maybe Ingragistics engineers can look into this matter and consider a fix in the later versions?
I can say that this behavior seems to be normal since the mouse capture isn’t necessary in WPF and because the XamGrid is originally build on Silverlight I believe your best option is to use the workaround you mention before in order to achieve your goal.
Hope this helps.