I am developing a Windows 8 Store app. I have made the following user controls:
< Code> & lt; UserControl x: Class = "RTV_W8. Animated Image" xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation" Xmlns: x = "http://schemas.microsoft.com/winfx/2006 / Xaml "xmlns: local =" using: RTV_W8 "xmlns: d =" http://schemas.microsoft.com/expression/blend/ 2008 "XMLN: MC =" http://schemas.openxmlformats.org/ Markup-compatibility / 2006 "MC: Ignorable =" d "d: DesignHite =" 300 "D: DesignView =" 400 "& gt; & Lt; UserControl.Resources & gt; & Lt ;! - Animate the opacity of the rectangle. - & gt; & Lt; Storyboard x: name = "containergridstoryboard" & gt; & Lt; Double animation storyboard TargetName = "MainGrid" storyboard. TargetProperty = "Opacity" = "0" from = "1" period = "0: 0: 5" Autorvers = "False" & gt; & Lt; / DoubleAnimation & gt; & Lt; / Storyboard & gt; & Lt; /UserControl.Resources> & Lt; Grid X: Name = "Main Grid" Cache Module = "Bitmap Cache" & gt; & Lt; Image Stretch = "uniformed" x: name = "picture" /> & Lt; / Grid & gt; & Lt; / UserControl & gt;
with the following CS file (only here partially displayed)
public animated image () {this.InitializeComponent (); this. Loaded + animated image_loaded; this. Pictogram Loaded + = picture_loaded; } Zero animated image_loaded (object sender, routing and averg e) {this.ContainerGridStoryboard.Beggin (); }
My problem is that the storyboard is not starting when the image is loaded. This user control is used inside other usercontrols. I have tried many ways to make the animation work, none of them works; I want the user to control the ambiguity, instead of just catching it, though I see through breakpoints Can containergridstoryboard .bizin (); Is executed on nothing on the screen
EDIT: Another user is used later in a data plate in Witch, if I work on the storyboard on the main grid, then user control Gets animated. But if I apply it to another grid (rooted in the main grid) or on any other element, the animation is not working. That's why I made animated images in the first place.
When I set the source of the image, and embed the UserControl in a page, as expected Image Fade in
Comments
Post a Comment