Uri Formatting on Image Source
问题 What is wrong with the following uri? bmi.UriSource = (new Uri(@"/Assets/Image.png", UriKind.Relative)); Where bmi is a BitmapImage . I have the build action for the image set to Embedded Resource. 回答1: Found it; bmi.UriSource = (new Uri("ms-appx:/Assets/Logo.png")); And build action set to Content. There's no Relative URI in RT. 回答2: WPF needs to use the Resource build action (or Content build action) to use Uris. For binary data (like an image), use Binary. If you're using a single project