petko_stankoski
petko_stankoski

Reputation: 10713

Accessing folder in wpf app

I have a wpf app with this folder structure:

enter image description here

In the HomeController, I want to access the Images folder. I want to store an image in the Images folder from the HomeController. How can I do this? I tried using pack origin but it takes me to bin.

Upvotes: 0

Views: 128

Answers (1)

Youp Bernoulli
Youp Bernoulli

Reputation: 5635

This should do the trick:

pack://application:,,,/Images/image.png

Can be used in xaml or in code. For more detailed explanation you can review this Microsoft page about it.

In code: Uri uri = new Uri("pack://application:,,,/Images/image.png");

In xaml: <element attribute="pack://application:,,,/Images/image.png"/>

Upvotes: 1

Related Questions