Search code examples
uwpuno-platform

Platform specific xaml that is throwing error for the UWP platform


I have platform specific xaml that is throwing error for the UWP platform.

Unexpected 'NONE' in parse rule 'Element ::= . EmptyElement | ( StartElement ElementBody ).'.

My Xaml looks like:

xmlns:wasm="http://uno.ui/wasm" 
xmlns:not_wasm="http://schemas.microsoft.com/winfx/2006/xaml/presentation"    
mc:Ignorable="d wasm not_wasm"

and

<ItemsPanelTemplate>
    <not_wasm:ItemsWrapGrid Orientation="Horizontal"  MaximumRowsOrColumns="8"/>
    <wasm:WrapPanel/>
</ItemsPanelTemplate>

The above builds without an error for wasm but for UWP it fails with the above error.
Any thoughts on what causes it?


Solution

  • The problem here is that your markup has the not_wasm namespace in the Ignorable list. So Windows ignores it, then thinks the <ItemsPanelTemplate /> is empty.

    In general, any platform-specific namespace that has "http://schemas.microsoft.com/winfx/2006/xaml/presentation" should not go in the Ignorable list. Any platform-specific namespace of the form "http://uno.ui/xxxx" should go in the Ignorable list.

    The correct markup would be:

    xmlns:wasm="http://uno.ui/wasm" 
    xmlns:not_wasm="http://schemas.microsoft.com/winfx/2006/xaml/presentation"    
    mc:Ignorable="d wasm"
    

    and

    <ItemsPanelTemplate>
        <not_wasm:ItemsWrapGrid Orientation="Horizontal"  MaximumRowsOrColumns="8"/>
        <wasm:WrapPanel/>
    </ItemsPanelTemplate>