You could create a converter such as:
public class PathToExecutableConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (parameter is string path)
{
string rootPath = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
return Path.Combine(rootPath, path);
}
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
And use it as follows:
<Window.Resources>
<local:PathToExecutableConverter x:Key="PathToExecutableConverter"></local:PathToExecutableConverter>
<ImageBrush x:Key="WindowBackground" ImageSource="{Binding ., Converter={StaticResource PathToExecutableConverter}, ConverterParameter=backgrounds/Zenitsu.jpg}" Stretch="UniformToFill"/>
</Window.Resources>
If the images will not change you might prefer to include them as embedded resources: How to reference image resources in XAML?