I have a xaml rectangle:
and want to change ImageScource based on URL:
It works only one time, after starting PowerGUI script editor, all subsequent changes (even after restart debugging) ending in an error message: new-object : Exception calling ".ctor" with "1" argument(s): "The system cannot find the file specified. (Exception from HRESULT: 0x80070002)" At C:\Users*****\Desktop\Tool\tl.ps1:113 char:20 + $imagesource = new-object System.Windows.Media.Imaging.BitmapImage $uri + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationException + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand Can you please help me to understand why it's working once, and how to get it to work? Tried also with
and
with similar results: the first replacement working OK, than there is a exception. |
↧
Setting ImageBrush ImageSource error in Powershell
↧