Sign in to follow this  
Winegums

[.net] Problem finding images in Blend/VS

Recommended Posts

Hi, I've taken some code from a book and, while the code runs fine from it's own file if put in XAMLPad, if i try running it in blend or VS it won't display the images used on the buttons. This is especially confusing as they appear in the Design view of the application. Is there a setup proces I have forgotten to do? here's the source Window1.xaml
<Window  x:Class="WindowsApplication4.Window1"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Title="Simple Window">
  <Window.Resources>
    <LinearGradientBrush x:Key="backgroundBrush" StartPoint="0,0" EndPoint="1,1">
      <GradientStop Color="Blue" Offset="0"/>
      <GradientStop Color="White" Offset="0.5"/>
      <GradientStop Color="Red" Offset="1"/>
    </LinearGradientBrush>
    <SolidColorBrush x:Key="borderBrush">Red</SolidColorBrush>
  </Window.Resources>
  <Window.Background>
    <StaticResource ResourceKey="backgroundBrush"/>
  </Window.Background>
  <DockPanel>
    <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal"
      HorizontalAlignment="Center">
      <Button Background="{StaticResource backgroundBrush}"
        BorderBrush="{StaticResource borderBrush}" Margin="5">
        <Image Height="21" Source="zoom.gif"/>
      </Button>
      <Button Background="{StaticResource backgroundBrush}"
        BorderBrush="{StaticResource borderBrush}" Margin="5">
        <Image Height="21" Source="defaultThumbnailSize.gif"/>
      </Button>
      <Button Background="{StaticResource backgroundBrush}"
        BorderBrush="{StaticResource borderBrush}" Margin="5">
        <Image Height="21" Source="previous.gif"/>
      </Button>
      <Button Background="{StaticResource backgroundBrush}"
        BorderBrush="{StaticResource borderBrush}" Margin="5">
        <Image Height="21" Source="slideshow.gif"/>
      </Button>
      <Button Background="{StaticResource backgroundBrush}"
        BorderBrush="{StaticResource borderBrush}" Margin="5">
        <Image Height="21" Source="next.gif"/>
      </Button>
      <Button Background="{StaticResource backgroundBrush}"
        BorderBrush="{StaticResource borderBrush}" Margin="5">
        <Image Height="21" Source="counterclockwise.gif"/>
      </Button>
      <Button Background="{StaticResource backgroundBrush}"
        BorderBrush="{StaticResource borderBrush}" Margin="5">
        <Image Height="21" Source="clockwise.gif"/>
      </Button>
      <Button Background="{StaticResource backgroundBrush}"
        BorderBrush="{StaticResource borderBrush}" Margin="5">
        <Image Height="21" Source="delete.gif"/>
      </Button>
    </StackPanel>
    <ListBox/>
  </DockPanel>
</Window>




Window1.xaml.cs

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;


namespace WindowsApplication4
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>

    public partial class Window1 : System.Windows.Window
    {

        public Window1()
        {
            InitializeComponent();
        }

    }
}




Edit: Tried adding the files as a resource in Visual Studio, but that seems to have made no difference other than now showing them as dead links in the 'project' view of Blend! [Edited by - Winegums on June 1, 2007 3:56:13 AM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this