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
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 path and return
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
// return whatever you want
}
}
Update your binding to use a converter