Search code examples
imagevisual-studio-2012silverlight-5.0expression-blend

I can't see an image in my Silverlight 5 project


When I started my Silverlight 5 project, I put an image with an animation (I did in Blend) on my main menu, it worked very well. Then I went forward in my project and I did not realize exactly at which moment I stopped seeing my image and animation.

I did a test on my project, creating a new user control, which only has the image and the animation, and it doesn't work, then I made a new project and put the image and the animation on the main page, and it works!

Does anyone have any idea what might be going on in my original project that prevents me from seeing the Image and animation?

Thanks a lot

An example, on my SilverlightControl1.xaml:

`

<UserControl.Resources>
    <Storyboard x:Name="Mtto2Animacion" RepeatBehavior="Forever" AutoReverse="False">
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.Rotation)" Storyboard.TargetName="image2">
            <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
            <EasingDoubleKeyFrame KeyTime="0:0:1.5" Value="55.77"/>
            <EasingDoubleKeyFrame KeyTime="0:0:2" Value="-0.217"/>
        </DoubleAnimationUsingKeyFrames>
    </Storyboard>
    <ImageBrush x:Key="BackgroundMTTO" ImageSource="Imagenes/MTTOBackground.png" Stretch="UniformToFill"/>
    <ImageBrush x:Key="IMGBannerPradera" ImageSource="Imagenes/BannerPradera.png" Stretch="UniformToFill"/>
</UserControl.Resources>

<Grid x:Name="LayoutRoot">
    <Image x:Name="image2" Margin="5" Source="Imagenes/MTTO2.png" Loaded="image2_Loaded">
        <Image.RenderTransform>
            <CompositeTransform/>
        </Image.RenderTransform>
    </Image>
</Grid>

`

And on my SilverlightControl1.xaml.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace MTTO
{
    public partial class SilverlightControl1 : UserControl
    {
        public SilverlightControl1()
        {
            InitializeComponent();
        }

        private void image2_Loaded(object sender, System.Windows.RoutedEventArgs e)
        {
            Mtto2Animacion.Begin(); 
        }
    }
}

This is my image (MTTO2.png)

this is my image (MTTO2.png)


Solution

  • Chris W. thank you very much!! I inspected all my image files used at my MainPage, and I set all as 'Resource' at Build Action Property, and it Works!! Do you know where I can learn how this property works? What does each of the options? thanks a lot again