# Silverlight issue: Image on button doesn't visible in application or in VS2010

**URL:** <https://forum.kirupa.com/t/silverlight-issue-image-on-button-doesnt-visible-in-application-or-in-vs2010/323012>\
**Category:** programming\
**Created:** [June 13, 2011, 10:13pm UTC](https://forum.kirupa.com/t/silverlight-issue-image-on-button-doesnt-visible-in-application-or-in-vs2010/323012 "2011-06-13T22:13:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hunsoul](https://avatars.discourse-cdn.com/v4/letter/h/f14d63/32.png) [@hunsoul](https://forum.kirupa.com/u/hunsoul)\
**Post date:** [June 13, 2011, 10:13pm UTC](https://forum.kirupa.com/t/silverlight-issue-image-on-button-doesnt-visible-in-application-or-in-vs2010/323012/1 "2011-06-13T22:13:16Z")

</div>

Hi All!

This is my first post here. 🙂 Let’s see…

I created a button and placed an Image on it in Silverlight. I’m using the latest version 5 (beta) and Expression Blend preview for Silverlight 5.

I really don’t understand why my image is unvisible on my button. I really hope that you’ll have some good ideas here…

Here’s my code:

I’ve a FirstPage.xml with \<navigation:Page…

```auto
    <navigation:Page.Resources>
        <Style x:Key="ButtonStyle1" TargetType="Button">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Grid>
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="FocusStates">
                                    <VisualState x:Name="Unfocused"/>
                                    <VisualState x:Name="Focused"/>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualStateGroup.Transitions>
                                        <VisualTransition GeneratedDuration="00:00:00.1000000"/>
                                    </VisualStateGroup.Transitions>
                                    <VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.726"/>
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.726"/>
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Normal"/>
                                    <VisualState x:Name="Pressed">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.562"/>
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.562"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Disabled"/>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Image x:Name="image" RenderTransformOrigin="0.5,0.5"
                                   Source="{TemplateBinding Content}" Stretch="Fill">
                                <Image.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform/>
                                        <SkewTransform/>
                                        <RotateTransform/>
                                        <TranslateTransform/>
                                    </TransformGroup>
                                </Image.RenderTransform>
                            </Image>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </navigation:Page.Resources>

    <Grid .... >
 ....
      <Button Grid.Column="1"
            Margin="0,17,0,20"
                Style="{StaticResource ButtonStyle1}"
                Content="Test.png"/>
    </Grid>
</navigation:Page>

```

The “Test.png” is in the root of the project - it’s build action is “Resource”.

The strange is:

- It is invisible in Visual Studio 2010 - i think it is not a problem
- It is invisible in App - that’s the problem 🙂
- It IS VISIBLE in Blend - strange!

Anyway, I managed to download an example from the WEB using the same technic - it was not on a navigation page, it was on the main page but it worked. Strange.

Any idea?
