0

I am using mahapps iconpacks and I come across this method "spin" but I have no idea how to bind it to a mouse over event

 <Button x:Name="btnRefresh" 
 Content="{iconPacks:PackIconMaterial Kind=Refresh, Spin=True}">

I want the icon to spin only when the mouse cursor is over the button and stop from spinning when it's not. Thanks.

Norbert Forgacs
  • 605
  • 1
  • 8
  • 27

1 Answers1

1

If anyone looks for an answer:

<Button x:Name="btnRefreshSpin" 
   Style="{DynamicResource MetroCircleButtonStyle}">
   <iconPacks:PackIconModern Kind="Refresh" Spin="{Binding Spin}" />
</Button>

and Spin is a simple method from the view model which returns true or false. A mouse over event can be linked to the same property

Norbert Forgacs
  • 605
  • 1
  • 8
  • 27
  • I get an error that a binding cannot be set on the Spin property of MaterialExtension. A Binding can only be set on a Dependency Property of a Dependency Object. Latest version so not sure if that property has not changed. – JMIII Aug 29 '19 at 20:18
  • 1
    It still works for me, I am using the following nugget package: Mahapps.Metro 1.6.5 and MahApps.Metro.IconPacks 3.0.0-alpha0096. I never really update this packages because every time a different error pops-up and I have to rename probably every icon used in my project. 0 backwards compatibility. – Norbert Forgacs Aug 30 '19 at 06:54
  • Thanks will look at other versions. – JMIII Sep 04 '19 at 21:23