Search code examples
silverlightsilverlight-4.0visualstatemanager

Silverlight 4: ExtendedVisualStateManager error when transitioning


So I have a control with 3 states each state toggles control visibility, and this is animated using FluidLayout. This works in blend when previewing the transitions, but when I go from the first state to the second state in browser, I get the following error.

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3) Timestamp: Fri, 17 Dec 2010 15:40:32 UTC

Message: Unhandled Error in Silverlight Application Code: 4004
Category: ManagedRuntimeError
Message: System.ArgumentException: Value does not fall within the expected range. at MS.Internal.XcpImports.CheckHResult(UInt32 hr) at MS.Internal.XcpImports.Collection_AddValue[T](PresentationFrameworkCollection1 collection, CValue value) at MS.Internal.XcpImports.Collection_AddDependencyObject[T](PresentationFrameworkCollection1 collection, DependencyObject value)
at System.Windows.PresentationFrameworkCollection1.AddDependencyObject(DependencyObject value) at System.Windows.Controls.UIElementCollection.AddInternal(UIElement value) at System.Windows.PresentationFrameworkCollection1.Add(T value) at Microsoft.Expression.Interactivity.Core.ExtendedVisualStateManager.WrapMovingElementsInCanvases(List1 movingElements, Dictionary2 oldRects, Dictionary`2 newRects) at Microsoft.Expression.Interactivity.Core.ExtendedVisualStateManager.GoToStateCore(Control control, FrameworkElement stateGroupsRoot, String stateName, VisualStateGroup group, VisualState state, Boolean useTransitions) at System.Windows.VisualStateManager.GoToState(Control control, String stateName, Boolean useTransitions) at Microsoft.Expression.Interactivity.VisualStateUtilities.GoToState(FrameworkElement element, String stateName, Boolean useTransitions) at Microsoft.Expression.Interactivity.Core.GoToStateAction.InvokeImpl(FrameworkElement stateTarget) at Microsoft.Expression.Interactivity.Core.GoToStateAction.Invoke(Object parameter) at System.Windows.Interactivity.TriggerAction.CallInvoke(Object parameter) at System.Windows.Interactivity.TriggerBase.InvokeActions(Object parameter) at System.Windows.Interactivity.EventTriggerBase.OnEvent(EventArgs eventArgs) at System.Windows.Interactivity.EventTriggerBase.OnEventImpl(Object sender, EventArgs eventArgs) at I2.Web.Reports.Models.MainModel.Service_GetUserCompleted(Object sender, GetUserCompletedEventArgs e)
at I2.Web.Reports.Services.ReportServiceClient.OnGetUserCompleted(Object state)

Anyone else had similar issues?


Solution

  • I found the answer, its a unique name thing, I had noticed that I hadn't named the instances that are getting animated. It seems to be a similar issue to this

    Bing maps silverlight control custom pushpin

    New rule: Name everything in Silverlight.

    It is important to note that the element who's Visibility is toggled in my app was actually a named Border however it's child UIElement must also be named, I'm not sure how far down the rabbit hole this goes...