I'm trying to make some simple engine with runtime model creation & dynamic animation bindings.
To do this i have to make some clones of storyboards that lives in resourcedictionary.
But there is something wrong: if i create storyboard clone and call .Begin() for it, then InvalidOparationExeption
"No applicable name scope exists to resolve the name 'submodel1'." occurs.
Here is simple expample: I have window with viewport.
SetTargetName called in foreach, because in real app i bind different animations to different models.
Just delete "sb = sb.Clone();" line and exeption will go away. But... i need multiple storyboard instances for my app :(
Model looks like this:
I've already tried to fix it with something like: "NameScope.SetNameScope(sb, NameScope.GetNameScope(CurrentViewport));" but it seems to be wrong...
Uploaded small test project here: http://clip2net.com/page/m9923/601660 (zip ~30kb)
There is also demo of another one issue with Storyboard.SetTarget() and immutable exeption. I wrote another big post about it, but at the end browser crashed and ruined all that i typed so long.. that's not my day :))
Ok, i hope somebody knows the answer.
ps: autosave-draft feature would be good for this forum ;)
- Edited by Antares19 Monday, February 09, 2009 7:08 AM test project uploaded
After spending a lot of time in goggling and testing i've found correct way to do this.
As i thought there is small simple thing i've missed here.
That's should be right after sb.Clone(); .
That will work for me now.
Anyway in my app, i'm creating a lots of model and storyboard clones. I think that registring+unregistring every clone in resources and namescopse will add noticeable performance overhead. Direct passing models to storyboards by SetTarget() seems to be a better way to do it. But there is "immutable" bug i've mentioned before. I think i'll post about it later in other new tread.
ps: in demo project there is some little copy-paste bug. last line should be sb.Begin(), as in example i've posted above.
pps: if someone interested, there is immutable bug demo in this demo project.
- Marked as answer by Antares19 Tuesday, February 10, 2009 2:46 AM