Search code examples
wpfxamlcomboboxexpression-blend

Image in ComboBox only visible in designer


Here's the situation:

I have a combobox within a button,, In expression blend when I add image to combo box item with the cod below, there's no problem apparently, image and textblock are showing well but as I run the proj.((F5)) there'e no sign of image, What I'm doing Wrong??? here's the code I use to add the image:

<ComboBoxItem Background="LightCoral" Foreground="Red"
         FontFamily="Verdana" FontSize="12" FontWeight="Bold">               
    <CheckBox Name="CoffieCheckBox">
        <StackPanel Orientation="Horizontal">
            <Image Source="coffie.jpg" Height="30"></Image>
            <TextBlock Text="Coffie"></TextBlock>
        </StackPanel>
    </CheckBox>

Any help Is much appreciated...


Solution

  • I had a similar problem showing images (used Uri strings) in a listview in a Silverlight application. They appeared properly in Expression Blend, but were not visible when I started it from Visual studio.

    I kept my images in a folder called Images in my project, by setting the "Build action" for my image properties into "Content" fixed the problem. Now they show up when running the application. Hope it helps!