When I try to change image for WPF trigger 'IsMouseOver' for button, the control flickers a lot.. Is there any workaround for this issue?
A:
Check if the image is already set to what you're setting it to. If it is set to what you're setting it to then don't set it again.
Brian R. Bondy
2010-03-27 21:00:00
I am using binding for this as below.. How can I implement your idea? Please let me know.<Trigger Property="IsMouseOver" Value="True"> <Setter TargetName="img" Property="Source" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=MouseOveImage}" /> </Trigger>
Vin
2010-03-27 21:01:39
I see, you could instead use the events of the objects and call back to a code behind function. I'm not sure of the way to fix it using triggers.
Brian R. Bondy
2010-03-27 21:13:19
Thanks, Is there any other trigger that is equivalent to IsMouseOver, I just want to change the image once when the mouse is over my button.
Vin
2010-03-27 21:14:58
Checkout the events MouseEnter and MouseLeave
Brian R. Bondy
2010-03-27 21:16:52