Phenomenal Posted March 10, 2018 Share Posted March 10, 2018 Fixed it... feel free to lock the thread.  I am trying to write a launcher application (just for fun) however whenever I try to load the background from a file the application wont open (line 3 is the cause of the issue). My code is: var BackgroundDirectory = System.IO.Path.Combine(Directory.GetCurrentDirectory(),"\\Background.png"); this.Title = ConfigurationManager.AppSettings["WindowName"]; this.Background = new ImageBrush(new BitmapImage(new Uri(BackgroundDirectory))); and I have placed Background.png in the release folder (configuration is set to release). Any help would be majorly appreciated!  Solution: var BackgroundDirectory = System.IO.Path.Combine(Directory.GetCurrentDirectory(),"Background.png"); this.Title = ConfigurationManager.AppSettings["WindowName"]; this.Background = new ImageBrush(new BitmapImage(new Uri(BackgroundDirectory))); should work however I chose to just use strings instead... string BackgroundDirectory = Directory.GetCurrentDirectory + "//Background.png"  Link to comment Share on other sites More sharing options...
panda Posted March 10, 2018 Share Posted March 10, 2018 1 hour ago, PhenomenalDev said: Fixed it... feel free to lock the thread. Â I am trying to write a launcher application (just for fun) however whenever I try to load the background from a file the application wont open (line 3 is the cause of the issue). My code is: var BackgroundDirectory = System.IO.Path.Combine(Directory.GetCurrentDirectory(),"\\Background.png"); this.Title = ConfigurationManager.AppSettings["WindowName"]; this.Background = new ImageBrush(new BitmapImage(new Uri(BackgroundDirectory))); and I have placed Background.png in the release folder (configuration is set to release). Any help would be majorly appreciated! You should actually provide the solution if you figured it out. Link to comment Share on other sites More sharing options...
Phenomenal Posted March 10, 2018 Author Share Posted March 10, 2018 9 minutes ago, panda said: You should actually provide the solution if you figured it out. Will update the thread, it was literally just because I misunderstood path.combine. Link to comment Share on other sites More sharing options...
Recommended Posts