1
votes

I have the following Xamarin.Forms XAML code:

 <TabbedPage.ToolbarItems>
        <ToolbarItem Name="tbiAdd"
                     Clicked="tbiAdd_Clicked"
                     Icon="Icon_Add"
                     Text="Add" />
        <ToolbarItem Name="tbiSettings"
                     Clicked="tbiSettings_Clicked"
                     Icon="Icon_Settings"
                     Text="Settings" />
</TabbedPage.ToolbarItems>

It works okay in Android but when I try to use it with UWP (or Windows Phone 8.1), I get an unknown error.

This is the code that catches it:

UnhandledException += (sender, e) =>
            {
                if (global::System.Diagnostics.Debugger.IsAttached) 
                  global::System.Diagnostics.Debugger.Break();
            };

This is the error:

E_UNKNOWN_ERROR

HRESULT E_FAIL has been returned from a call to a COM component.

If I comment the XAML out, it works okay.

ToolbarItem is a not supported control in UWP? What should I check?

1

1 Answers

0
votes

You have to provide proper icon paths:

   <ToolbarItem.Icon>
       <OnPlatform x:TypeArguments="FileImageSource"
                   Android="Icon_Add"
                   WinPhone="Assets/Icon_Add.png" />
  </ToolbarItem.Icon>

The error message should tell me that...