1

I'm trying to bind a list in xaml as an itemsource. The catch is, the list is kept in a resource file within another project's properties (in the same solution). I've been trying to create a namespace but it continues to tell me that myproject.Properties.Resources does not exist when it clearly does.

Short example to help explain the rough idea: Project1.xaml

<Grid ItemsSource={Binding (binding goes here)} />

Project2.Properties.Resources

public static namespace.listobject MyList;

Hopefully it's relatively straightforward and someone can give me an answer soon. Thanks in advance!

dragnflier
  • 147
  • 1
  • 11
  • Did you search this up? Does [this question](http://stackoverflow.com/q/1652189/1698987) works for you ? – Noctis May 29 '14 at 03:42
  • I had a search around. I didn't see that before but that still doesn't work. – dragnflier May 29 '14 at 04:05
  • do you get the same error ? (and out of curiosity, did you try rebuilding your solution?) – Noctis May 29 '14 at 04:20
  • Yeah, the same error. I have cleaned and rebuilt the solution several times. It's the properties of the project; they always exist. – dragnflier May 29 '14 at 04:33
  • I can get it to the project but it doesn't want to find the properties within the project. – dragnflier May 29 '14 at 04:39
  • so it's not a general resource, it's the project`s properties one that gives you grief? – Noctis May 29 '14 at 04:40
  • yes. I probably worded the question really wrong to signify that. I'll fix that now – dragnflier May 29 '14 at 05:12
  • possible duplicate of [Accessing another project's settings file](http://stackoverflow.com/questions/2548476/accessing-another-projects-settings-file) – Noctis May 29 '14 at 22:20
  • have a look at [this question](http://stackoverflow.com/q/2548476/1698987). I believe it should work :) – Noctis May 29 '14 at 22:20
  • Sorry for the delayed reply. It works now (well, at least that bit. Onto the next problem...) Thanks! – dragnflier Jun 23 '14 at 00:45

1 Answers1

0

If you defined the Ressource over the SolutionExplorer -> Properties -> Resspource -> AddRessource, then you should have no Problem implementing this solution:

<Window>
    <Window.Resources>
            <BitmapImage x:Key="Image1" UriSource="Resources/yourimage.bmp" />
    </Window.Resources>
   <Grid>
       <Image  Source="{StaticResource Image1}"/>
   </Grid>
</Window>

Don't forget to set the Build Action Property of the Image file to Ressource.