c# - UserControl animation Cannot resolve TargetName -


i'm trying create simple animation in uwp user control, i'm running error cannot resolve targetname. code simple , feel overlooking obvious, can't figure out.

xaml

<usercontrol     ...     x:name="manipulationmediaviewercontrol"     ...     >     <usercontrol.resources>         <storyboard x:name="zoomanimation">             <doubleanimation duration="0:0:0.25" to="4" storyboard.targetproperty="(uielement.rendertransform).(compositetransform.scalex)" storyboard.targetname="viewboxhost" d:isoptimized="true"/>             <doubleanimation duration="0:0:0.25" to="4" storyboard.targetproperty="(uielement.rendertransform).(compositetransform.scaley)" storyboard.targetname="viewboxhost" d:isoptimized="true"/>         </storyboard>     </usercontrol.resources>      <grid>         <viewbox x:name="viewboxhost"                  manipulationmode="all"                  width="{binding elementname=manipulationmediaviewercontrol, path=actualwidth}"                  height="{binding elementname=manipulationmediaviewercontrol, path=actualheight}">             <viewbox.rendertransform>                 <compositetransform centerx="0.5" centery="0.5" />             </viewbox.rendertransform>             <contentpresenter />         </viewbox>     </grid> </usercontrol> 

code

using windows.ui.xaml.controls; namespace manipulationmediaviewer {     public sealed partial class manipulationmediaviewer : usercontrol     {         public manipulationmediaviewer()         {             this.initializecomponent();         }          public void zoomtofactor()         {             zoomanimation.begin(); // breaks here         }     } } 

so problem when try start zoomaninmation.begin();, exception:

winrt information: cannot resolve targetname viewboxhost. additional information: no installed components detected.

i have code in similar situation in different project seems work fine (it outside of user control). when didn't work deleted code , created storyboard through blend ui, resulted in same code. appreciated!

thanks!

i had same issue in visual studio 2017. ended compiling usercontrol in own uwp dll , adding new project reference. issue went away after dowing that.


Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -