Utility.cs
/// <summary>
/// Gets a WPF image source located in this project, based on the file name in the '/Resources/' folder.
/// </summary>
/// <param name="fileName">The file name to search for.</param>
/// <returns>An image source containing the found image if the file exists, otherwise; null.</returns>
Gets a WPF image source located in this project, based on the file name in the '/Resources/' folder.
Gets a WPF image source located in this project based on the file name in the ' / Resources / ' folder .
public ImageSource GetWpfImageSource(string fileName)
        {
            if(!string.IsNullOrEmpty(fileName))
            {
                return new BitmapImage(new Uri($"pack://application:,,,/Inspectify;component/Resources/{fileName}", UriKind.Absolute));
            }
            else
            {
                return null;
            }
        }
public ImageSource GetWpfImageSource ( string fileName ) { if ( ! string . IsNullOrEmpty ( fileName ) ) { return new BitmapImage ( new Uri ( $" pack://application:,,,/Inspectify;component/Resources/ { fileName } " , UriKind . Absolute ) ) ; } else { return null ; } }
Gets a WPF image source located in this project, based on the file name in the '/Resources/' folder.
Gets a WPF image source located in this project based on the file name in the ' / Resources / ' folder .
An image source containing the found image if the file exists, otherwise; null.
An image source containing the found image if the file exists otherwise ; null .
fileName
string
The file name to search for.
The file name to search for .