UWP C# Fill Rectangle with Image
<p>My program has a rectangle that I color depending on the color from a color picker.  What I want to do is to have it choose an image for black instead of just showing black.  The code I have to fill the rectangle with the image is:</p>

<pre><code>p1rect1.Fill = new ImageBrush
{
    ImageSource = new BitmapImage(new Uri(@"pack://application:,,,/LED;Assets/Images/off.png", UriKind.Absolute))
};
</code></pre>

<p>I located this code from a c# wpf discussion, but it doesn't seem to be working in mine, which is UWP.  What happens is that the rectangle doesn't change at all and is left as its original color when it was created in the xaml code.</p>

<p>What would the proper code be to put an image into a rectangle in C# code?  Thanks.</p>