Forum Xamarin Cross Platform with Xamarin

MVVMCross for WPF UI - Getting Error

I need to build a WPF UI and I am trying to use MVVMCross as the MVVM framework. I download MVVMCross binaries from github and followed the article on code project http://www.codeproject.com/Articles/566635/MvvmCross-TipCalc-Step-6-Creating-a-WPF-UI

But when I compile the solution once I change the user control to MvxWPFView in the xaml and partial class I get the error The name "MvxWpfView" does not exist in the namespace "clr-namespace:Cirrious.MvvmCross.Wpf.Views;assembly=Cirrious.MvvmCross.Wpf".

What could be the issue? Is the binaries wrong? How can I resolve this. I want to build WPF app using .NET faremwork 4.5 and using VSTS2012 IDE. Currently I have not installed Xamarin platform on my Windows 8 machine. I want to first build the app on Windows and then share the code and build new UI for iOS devices. Please help.

Answers

  • JimBlizzardJimBlizzard USMember

    Hi Juliels - looks like you may have typed the name of the view in the XAML file as view:MvxWPFView (with all caps for WPF). It should be view:MvxWpfView. Triple-check the spelling and capitalization in the XAML and its .cs file. . . .

    Hope this helps,
    -bliz

  • JulielsJuliels INMember

    No Jim. I have used the proper case for MvxWpfView. When I try the code sample given at http://www.codeproject.com/Articles/566635/MvvmCross-TipCalc-Step-6-Creating-a-WPF-UI and compile I get the below three errors.

    Error 1 The name "MvxWpfView" does not exist in the namespace "clr-namespace:Cirrious.MvvmCross.Wpf.Views;assembly=Cirrious.MvvmCross.Wpf".

    Error 2 The type 'views:MvxWpfView' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.

    Error 3 Cannot implicitly convert type 'MVVMCross_App.Views.MyFirstView' to 'Cirrious.MvvmCross.ViewModels.IMvxViewModel'. An explicit conversion exists (are you missing a cast?)

    I have referred the MVVMCross binaries as told in the article.
    What could be wrong?

    Please help

  • JimBlizzardJimBlizzard USMember

    Hi Julie, have you been able to resolve the issue?

    When I followed the TipCalc tutorials to create my WPF app, I used NuGet (Tools > Library Package Manager > Manage NuGet Packages for Solution...) to add MvvmCross, which automatically all the references to the Cirrious DLLs. Is this how you did it?

    Also, I copied the contents of the App.Xaml.Mvx.cs partial class definition and pasted it into App.xaml.cs, starting from private bool _setupComplete; through the end of the LoadMvxAssemblyResaources() method.

    Oh - I just noticed in the sample code on the tutorial page for TipView.cs, they have the namespace listed as "namespace TipCalc.UI.Wpf.Views". It should be "namespace TipCalc.UI.Wpf". (It should be the same as the WPF project name.)

    I don't know if one of these would fix your issue, but they're worth checking.

    Hope this helps!
    -bliz

Sign In or Register to comment.