Image on a RadRadioButton

3 posts, 1 answers
  1. Lisa
    Lisa avatar
    35 posts
    Member since:
    May 2011

    Posted 21 Jul 2011 Link to this post

    I'm trying to put an image on a RadRadioButton and am getting a warning when I build saying "The file 'Images/1Zone.png' is not part of the project or its 'Build Action' property is not set to 'Resource'".

    I've checked the property, and it is set to Resource.  I've added the file and even checked it into TFS.  It is in the project.  I can modify the image source to point to another file in the folder and it displays.  It is a .jpg file, so I made a copy of my file as a .jpg and that didn't work.  I'm not sure at this point what I am doing wrong.  Anyone have any ideas?

    My xaml code:

    <telerik:RadRadioButton    Height="40" HorizontalAlignment="Left" Margin="6,29,0,0" Name="radioButton1" VerticalAlignment="Top"   Click="radioButton1_Click_1">
         <Image x:Name="btnImage1" Source="Images/1Zone.png" />

    Attached is a screen shot of my Solution Explorer showing the file is there.

    Thanks for any help


  2. Answer
    Zarko avatar
    755 posts

    Posted 26 Jul 2011 Link to this post

    Hi Lisa,
    I'll copy/paste here the answer that I gave you on your support thread:
    "The problem is that the cdbChartPage user control in which you are using the images is not on the same hierarchy level as the Images folder - your folder hierarchy is like this:
    - Images
    - ViewModels
    - Views
            - cdbChartPage
    This means that the path to the images is not Images/1Zone.png but it is ../Images/1Zone.png so you should define your image like this:
    Copy Code
    <telerik:RadRadioButton Height="40" HorizontalAlignment="Left" Margin="6,29,0,0" Name="radioButton1" VerticalAlignment="Top" Click="radioButton1_Click_1">
    <Image x:Name="btnImage1" Source="../Images/1Zone.png" />
    I've attached your project without most of its code (and dlls) but with visible images so could you please examine it and if you have more questions feel free to ask."

    Best wishes,
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  3. Lisa
    Lisa avatar
    35 posts
    Member since:
    May 2011

    Posted 26 Jul 2011 Link to this post

    Thank you!  That works great in both the xaml and the code-behind.
Back to Top