Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Xamarin.Forms UWP ImageRessources issue

RobinDelageRobinDelage FRMember
edited March 2016 in Xamarin.Forms

(I'm sorry for my crappy english I'm French)
Hello , I have an issue with ImageRessources from Xamarin.Forms on my MainPage.xaml.g.cs InitializeComponent, on the line this.LoadFromXaml(typeof(MainPage));

i have this exeption :
'System.MissingMethodException' in Xamarin.Forms.Xaml.dll
Method not found: 'Xamarin.Forms.ImageSource Xamarin.Forms.ImageSource.FromResource(System.String)'.

when i delete this line : from my MainPage.xaml i have no problem but i need this line.

I have this exception problem only on UWP and not on iOs or Android

Thank you for your time.

Posts

  • ThomasBurkhartThomasBurkhart DEMember ✭✭✭✭

    Could you show uas the XAML?

  • RobinDelageRobinDelage FRMember
    edited March 2016

    Here is my MainPage.xaml

    <?xml version="1.0" encoding="UTF-8"?>


    <ContentPage.Padding>

    </ContentPage.Padding>





    <Grid.RowDefinitions>




    </Grid.RowDefinitions>

    <Grid.ColumnDefinitions >

    </Grid.ColumnDefinitions>



















  • ThomasBurkhartThomasBurkhart DEMember ✭✭✭✭

    Do you have included the MarkupExtension for ImageResourceslike this one?

        [ContentProperty("Source")]
        public class ImageResourceExtension : IMarkupExtension
        {
            public string Source { get; set; }
    
            public object ProvideValue(IServiceProvider serviceProvider)
            {
                if (Source == null)
                    return null;
                return ImageSource.FromResource(Source);
            }
        }
    
  • RobinDelageRobinDelage FRMember

    Yes i have ;)

  • RobinDelageRobinDelage FRMember

    It's work fine on android and ios

  • ThomasBurkhartThomasBurkhart DEMember ✭✭✭✭

    Strange, I load Images from my resource on UWP without problem. I also had problems with adding a UWP-Project to my existing project. So I created a new solution, which automatically adds now a UWP-Project and added all my PCL-Projects to this solution and it worked.

  • RobinDelageRobinDelage FRMember

    Ok i'll try that, thank you for you help

  • ThomasBurkhartThomasBurkhart DEMember ✭✭✭✭

    You are welcome and in the same Timezone (Germany), so feel free to contact me.

  • RobinDelageRobinDelage FRMember

    Just for information what type of project did you create (Cross-Platform/BlankApp(Xamarin.Forms Portable) or Shared or Native Portable or Native Shared ?

  • ThomasBurkhartThomasBurkhart DEMember ✭✭✭✭

    For UWP at this time only Xamarin.Forms Portable works.

  • RobinDelageRobinDelage FRMember

    Ok Thanks for you help ;)

  • RobinDelageRobinDelage FRMember

    You added all your projects and override those who are created automatically ?

  • ThomasBurkhartThomasBurkhart DEMember ✭✭✭✭

    Actually I copied the platform specific parts into the automatic created, so make sure every works

  • RobinDelageRobinDelage FRMember

    Ok thank you i'll try this afternoon

  • DevologyDevology GBMember ✭✭✭

    Change the line to include a second parameter - this works for me in debug and release modes.

    var imageSource = ImageSource.FromResource(Source, Assembly.GetExecutingAssembly());
    
Sign In or Register to comment.