Skip to content

Script Chokes on <Window.Resources> ControlTemplate Copy #3

@futuremotiondev

Description

@futuremotiondev

Hi there!

This script is a serious time saver.

I can get it to work, but it seems to choke on some more complex XAML. I've attached the failing XAML document to this post. (It's a zip file because Github doesn't allow me to upload XAML)

MainWindow.zip

The error:

12-04 02:42:42 D:\Dev\Powershell> d:\Dev\Powershell\Scripts\PowerShell_XAML\Snippet.ps1
WARNING: Unable to parse XML, with error: Exception calling "Load" with "1" argument(s): "Cannot create unknown type '{http://schemas.microsoft.coas.microsoft.com/winfx/2006/xaml/presentation}Null'."
 Ensure that there are NO SelectionChanged or TextChanged properties in your textboxes (PowerShell cannot process them)
ParentContainsErrorRecordException: D:\Dev\Powershell\Scripts\PowerShell_XAML\Snippet.ps1:334:5
Line |
 334 |      $Form=[Windows.Markup.XamlReader]::Load( $reader )
     |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Exception calling "Load" with "1" argument(s): "Cannot create unknown type
     | '{http://schemas.microsoft.com/winfx/2006/xaml/presentation}Null'."

I think the reason is that the parser can't handle the <Window.Resources> content. I created this block so I could customize my comboboxes a bit more, but I have a feeling the code won't be parsable for PowerShell.

If there is any way you can take a look, that would be super helpful.

Thanks for the awesome script!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions