{"id":5040,"date":"2014-03-30T18:19:36","date_gmt":"2014-03-30T18:19:36","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/can-i-set-the-base-path-outside-of-my-application-directory-when-binding-an-image-source-path-to-a-relative-path-in-wpf-collection-of-common-programming-errors\/"},"modified":"2014-03-30T18:19:36","modified_gmt":"2014-03-30T18:19:36","slug":"can-i-set-the-base-path-outside-of-my-application-directory-when-binding-an-image-source-path-to-a-relative-path-in-wpf-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/can-i-set-the-base-path-outside-of-my-application-directory-when-binding-an-image-source-path-to-a-relative-path-in-wpf-collection-of-common-programming-errors\/","title":{"rendered":"Can I set the base path outside of my application directory when binding an image source path to a relative path in WPF?-Collection of common programming errors"},"content":{"rendered":"<p>Declare a static field say BasePath in code behind<\/p>\n<pre><code>class Utility\n{\n    public static BasePath;\n}\n<\/code><\/pre>\n<p>assign it the path that you want to use as base path<\/p>\n<p>declare a converter like this:<\/p>\n<pre><code>public class RelativePathToAbsolutePathConverter : IValueConverter\n{\n    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)\n    {\n        \/\/conbine the value with base path and return\n    }\n\n    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)\n    {\n        \/\/ return whatever you want\n    }\n}\n<\/code><\/pre>\n<p>Update your binding to use a converter<\/p>\n<pre><code>\n\n\n\n\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Declare a static field say BasePath in code behind class Utility { public static BasePath; } assign it the path that you want to use as base path declare a converter like this: public class RelativePathToAbsolutePathConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { \/\/conbine the value with base [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5040","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5040","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5040"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5040\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5040"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5040"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5040"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}