Basically, all I’m looking to do is change the color of the link when the mouse hovers over it and leaves… While its possible to do this on the CS portion of my page, I’d prefer to do this in XAML because I reuse the link template all over the place. When I try the following, I get the Error message “Error HRESULT E_FAIL has been returned from a call to a COM component.”;
<DataTemplate x:Key="ciruitLinkTemplate">
<go:LinkPanel go:Part.SelectionElementName="Path" >
<go:Link.Route>
<go:Route RelinkableFrom="True" RelinkableTo="True" />
</go:Link.Route>
<Path go:LinkPanel.IsLinkShape="True" Name="myPath" Stroke="Black" StrokeThickness="2">
<Path.Triggers>
<EventTrigger RoutedEvent="Path.MouseEnter">
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetName="myPath"
Storyboard.TargetProperty="(Fill).(Color)"
Duration="00:00:08"
From="Black" To="Red"
/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
<EventTrigger RoutedEvent="Path.MouseEnter">
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetName="myPath"
Storyboard.TargetProperty="(Fill).(Color)"
Duration="00:00:08"
From="Red" To="Black"
/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Path.Triggers>
</Path>
</go:LinkPanel>
</DataTemplate>I am not sure the error. At least the 2 event triggers are"Path.MouseEnter" now. I think you want “Path.MouseEnter” and “Path.MouseLeave”, correct?
I think those aren’t the only errors. It also depends a lot on which platform you are targeting.
Darren_sellenr, what I would do is to implement the animation on a Shape in a trivial application, to make sure that it worked.
Then you’ll be able to move with confidence the XAML/code into your app and into Diagram templates.