I just cannot figure this out. I am trying to use a converter for a StaticResource call. On app startup I get the error Argument Cannot Be Null Parameter name: assemblyName XAML. Here is what I have.
Converter Class:
using System;
using System.Globalization;
using System.IO;
using Xamarin.Forms;
namespace MyApp.Converters
{
public class ByteArrayToImageSourceConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
{
return null;
}
byte[] bytes = value as byte[];
return ImageSource.FromStream(() => new MemoryStream(bytes));
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
And in my XAML:
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:converters="clr-namespace:MyApp.Converters; assembly=MyApp"
x:Class="MyApp.FriendsForm">
<ContentPage.Resources>
<ResourceDictionary>
<converters:ByteArrayToImageSourceConverter x:Key="bytesToImage"></converters:ByteArrayToImageSourceConverter>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<ListView x:Name="listView">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
..............
Even before calling the function I get the above error when starting the app up. It seems related to the namespaces or xmlns but I just cant figure it out. Thank you for your help!