locked
Change Fill of BlockArraw upon MouseEnter event RRS feed

  • Question

  • Hi,

    Can someone please tell me how I can change the color/fill of a "Block Arrow" when the mouse pointer hovers above it?

    I have the "mouse enter" event setup which is reached but I can't figure out how to change the fill as I don't understand the concept of the dependencypropertykey. There are several examples shown out there but they seem fairly complex so I'm hoping for a compact/elegant solution.

            private void BlockArrow_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)        {	    var arrow = (Microsoft.Expression.Shapes.BlockArrow)e.OriginalSource;            arrow.Fill.SetValue(??				}

    Thx

    Saturday, December 22, 2012 2:39 PM

All replies

  • You can set it like this example:

    var arrow = (Microsoft.Expression.Shapes.BlockArrow)sender;
    			arrow.Fill = new SolidColorBrush(Colors.Red);

    You can use any kind of Brush, not just SolidColorBrush. Also, there are other ways to do this, in WPF for example you can use triggers, but that won't work in Silverlight/Phone.

    Monday, December 24, 2012 3:57 AM
    Moderator