xamarin,viewmodel,mvvmcross,lookup-tables , Why “removing any who's ViewModel PropertyType is an interface” when creating the MvvMCross View lookup table

Why “removing any who's ViewModel PropertyType is an interface” when creating the MvvMCross View lookup table


Tag: xamarin,viewmodel,mvvmcross,lookup-tables

When creating the default View lookup table in MvvMCross, there is a step "removing any who's ViewModel PropertyType is an interface". (http://slodge.blogspot.de/2013/01/overriding-view-lookup-convention-used.html) Why is this step performed?

It's clear, that you can't instantiate an interface, but I can navigate to Interface implementing ViewModels with ShowViewModel<IMyViewModel>(), if I write Mvx.Register<IMyViewModel, MyViewModel>(). Isn't the View creator using the DI table?


When we were looking at this area of Mvx back in 2013 we didn't really find any users who wanted to hide each ViewModel behind interfaces, and we really didn't come across users who wanted to navigate using interfaces.

Instead users generally wanted:

In the case where interfaces were used for groupings - e.g. for IRefreshableViewModel then it was quite common to see a base View class implemented too - and to see it have an IRefreshableViewModel ViewModel property. It is these views that are supposed to be removed in the step you mention.

Because of this, we didn't use interfaces for the default ViewModel navigation... and so ViewModel's aren't in the DI/IoC/ServiceLocator lookup system.

However, we did leave Mvx open for adjustment - it's in the manifesto - so if your app wants to navigate by interfaces and if you want your Views to reference ViewModel interfaces instead of concrete classes, then you can absolutely do this - you'll just need to override the Setup steps to put your View-ViewModel lookup and your ViewModel factory in place (there are actually details on this in the wiki)


mono - xamarin studio System.MissingMethodException

As the title says when I start the project it gives System.MissingMethodException but then I hit refresh on browser and it works. What is the problem with first start ? .net 4.5 and mvc 4 System.MissingMethodException Method 'HostingEnvironment.get_InClientBuildManager' not found. and also System.Web.Entity not found in references and also after...

How to Add Click event in Stack Layout or Frame

I am new in xamarin.forms please help me out how i can add click event in Stack Layout or Frame <Frame Grid.Column="0" BackgroundColor="#ffffff" Grid.Row="0" HasShadow="true" OutlineColor = "Black"> </Frame> <StackLayout Grid.Column="0" BackgroundColor="#313FA0" Grid.Row="0"> </StackLayout> ...

UIAlertView popup won't let me swipe up Control Center

I'm currently working on a Xamarin MvvmCross ios app. I have it set to display a UIAlertView popup to inform the user when their internet is disabled (the app requires an internet connection). The problem is that when this popup shows, the user can't swipe up the Control Center to...

Using Android Toolbar

I'm following the following tutorial to implement the toolbar: http://blog.xamarin.com/android-tips-hello-toolbar-goodbye-action-bar/ When I write this code some things cannot be resolved. protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.Main); var toolbar = FindViewById<Toolbar> (Resource.Id.toolbar); //Toolbar will now take on default Action Bar characteristics SetActionBar (toolbar); //You can now...

Building C# code in VSCode on Mac

I've been building a command line tool using Xamarin. After being told about Visual Studio Code, I wanted to see if I could try using it as an editor and debugger. I managed to get it to debug an existing .exe file built with Xamarin, by editing the launch.json file,...

Cannot implicity List into IEnumerable

My ViewModel public class ViewModelCT { public IEnumerable<SelectListItem> Tests { get; set; } public IEnumerable<string> SelectedTests { get; set; } public Course course { get; set; } } Controller public ActionResult Details(int id) { Course course = functionality.toCourse(functionality.GetCourseById(id)); List<SelectListItem> lsli = new List<SelectListItem>(); ViewModelCT vm = new ViewModelCT(); foreach (SchoolService.Test...

InvalidCastException in release when casting TextFormatted to ISpannable or ISpanned

This question is the same but it doesn't seem to answer the question as to why this cast fails in release mode but works in debug. The Android docs specify: Return the text the TextView is displaying. If setText() was called with an argument of BufferType.SPANNABLE or BufferType.EDITABLE, you can...

namespace prefix “myapp” is not defined in Xamarin While Building App?

I want to build a Toolbar in Xamarin app. When i want to create a menu it shows me error saying that "namespace prefix "myapp" is not defined". Here is code. <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res/android-auto"> <item android:id="@+id/action_reply" android:icon="@drawable/ic_action_reply" android:title="Reply" myapp:showAsAction="always" /> <item android:id="@+id/action_undo" android:icon="@drawable/ic_action_undo" android:title="Undo"...

Offline authentication best practices in Xamarin

I intend to create a Xamarin(.Forms) application, and it has to have authentication: the user should provide a username and password to obtain data. The problem is that it has to work offline as well (meaning it shouldn't rely on a server for the authentication process). I considered the following...

Where is the android signing key on the disk that Xamarin Studio creates?

I'm publishing using a key that I created in Xamarin Studio. Where is that key on the disk so I can take a backup of it?

Accessing Activity Methods from WebChromeClient

I am using Xamarin to write an Android application, and in that application, I have a webview that needs to load at the creation of the app and after it is fully loaded, I call some javascript into the HTML page to set up the graph. I am trying to...

Xamarin.Android and Parse

I am writing an app with C# and Xamarin.I am using Parse at the backend.I am currently stuck at point where when a user clicks signup button my app checks for a user with same phone number in parse database.Ideally If app finds app makes a toast of "cannot signup".If...

ViewPager that listens to clicks

I need a ViewPager that enables to user to swipe images. But on a click on the images, a new activity has to start with another, bigger viewpager that contains the same images. How can i implement a click listener while still keeping the swipe on the viewpager?...

Application can't run in Samsung S6

I have a Xamarin.Android App compiled and packaged. It works on any device Blu Dash 3.5, Samsung S5 and inferior, Hummer, etc. In Xamarin Studio I go to Options --> Application Build --> Advanced --> Supported ABIs and mark all of them: armeabi armeabi-v7a x86 arm64-v8a x86_64 So, I put...

Add ios project to xamarin forms solution with droid project

I've got a xamarin forms solution with a pcl and a .Droid project. Now I also want to add ios to the solution. How do I do this. From the add dialog I can select add new project, but it seems to add a lot more....So the solution was first...

CLLocation DistanceFrom performance implications

I'm developing an iOS application where I need to track the distance walked by the user real-time and alter data accordingly. Essentially what I'm doing is, as soon as the user makes a move, I check the distance between the original and current positions and react accordingly (using CLLocation's DistanceFrom...

Running on iOS 7.1 simulator brings errors in the console output

I'm using Xamarin Studio 5.9.3 on Mac with Mono 4.0.1, Xcode 6.3.2 and Xamarin.iOS When I try to run my app in the iOS 7.1 simulator I get the following console output: objc[1102]: Class AXEmojiUtilities is implemented in both /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 7.1.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/AccessibilityUtilities.framework/AccessibilityUtilities and /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS...

Camera Preview and OCR

I am new to android development - I'm using Xamarin. I am trying to write an application that initiates the camera preview, and then constantly scans the incoming frames for text (I am using Xamarin.Tesseract from NuGet). In other words, I don't want to make the user take a photo...

Why is my app requesting permissions I didn't ask for?

my APK is requesting these permissions: android.permission.ACCESS_NETWORK_STATE android.permission.BIND_NOTIFICATION_LISTENER_SERVICE android.permission.INTERNET android.permission.READ_EXTERNAL_STORAGE android.permission.READ_LOGS android.permission.WRITE_EXTERNAL_STORAGE I can see that when I try to publish the APK on the play store or when I try to install the APK on my physical device. However, my app manifest only has: <uses-permission android:name="android.permission.INTERNET" /> <uses-permission...

How to wait for a return value from an event handler without blocking main UI thread

So I have this method this uses a library to generate an external webpage to allow the user to enter their Facebook credentials for verification. Upon entering it we are creating a profile based on the that user's account and saving it to a database. Once we save it to...

How to supply dynamic data set to a single view using ViewModels

(first time posting and fairly new to MVC) I currently have a MVC/C# application where the user selects a list of ID's and then chooses a Report Type (8 possible different reports calling 8 different database views). I am passing all of these parameters to the controller. Based on the...

How to customize Xamarin.Forms app?

How can I customize the appearence of xamarin.forms components? I want each button to have the same image, for instance. Or for all systems to share the same login screen with the same background image. I know I can do that by adding one specific screen to each platform project....

How to run mtouch command to launch Xamarin.iOS app on simulator for automated testing?

I am new to Xamarin and I need to be able to launch a Xamarin iOS app on iOS simulator from command line. I have tried running mtouch but obviously am missing on something as I am not able to successfully launch the app on simulator. I don't know if...

TableView Header Section Covers The Rows

I have two questions: 1- I'm trying to do a simple table view with Xamarin forms, but i have found that the header sections cover the below cells (rows in table). I just wants that the header section disappears like the cells when move the page and just maintain de...

Xamarin MvvmCross ViewModel Validation

I'm building my first Xamarin MvvmCross application at the moment and I'm currently looking at validating user input to the view models. Doing a lot of searching around everything (including the MvvmCross team) link to this plugin: MVVMCross.Plugins.Validation This plugin makes use of a very old version of MvvmCross v3....

Xamarin : Loading resources via GetManifestResourceStream

I am working on a Xamarin forms project to use OpenGL/OpenTK. I am trying to load a shader using GetManifestResourceStream. Whatever I do I get null code is being run from .Shared project, shaders are in .ios / .Android resources directory string prefix; #if __IOS__ prefix = "OpenGLTesting.iOS."; #endif #if...

Floating Action Button in Xamarin.Forms

I had completed my App's home page in Xamarin.Forms Portable. Now i want to add a Flotation Action Button In my Android Project ! Is there any way to add FAB for Android in my existing home page, which was coded in Xamarin.Forms Portable. OR I want to create a...

MvvmCross RaisePropertyChanged and dot (.) binding

I have a custom binding that accepts entire view model: public class TextViewGroupInfoBinding : BaseBinding<TextView, GroupViewModel> { private IMvxAndroidCurrentTopActivity CurrentTopActivity { get { return ServiceLocator.Current.GetInstance<IMvxAndroidCurrentTopActivity>(); } } public TextViewGroupInfoBinding(TextView androidControl) : base(androidControl) { } public override MvxBindingMode DefaultMode { get { return MvxBindingMode.OneWay; } } protected override void SetValueToView(TextView control,...

How to define half of the screen size in XML

I have the following code which is written programmatically, Display display = this.WindowManager.DefaultDisplay; Point size = new Point(); int height = size.Y; bViewLayout.Height = (int)(height * 0.5); However, I wonder how I could achieve half of the screen in Xml rather than hard coded as follows? <GridLayout android:layout_columnSpan="1" android:layout_gravity="fill" android:layout_rowSpan="1"...

Using an iPad as the networked Mac for Xamarin.iOS for Visual Studio

This guide explains how to use Xamarin.iOS for Visual Studio and a network available Mac as the host for Apple's complier: http://developer.xamarin.com/guides/ios/getting_started/installation/windows/introduction_to_xamarin_ios_for_visual_studio/ It is possible to use an iPad as the networked Apple compliler?...

Connecting Python Backend to Android APP

How to use python as a backend for an Android App that is built using C#? The Python Backend is written using the Flask framework. The Android app is built using xamarin.

Use Tab with new ToolBar (AppCompat v7-21) in mvvmcross

I have use support_v7 Toolbar as ActionBar, but i getting problem to add tabs in my activity. Is there any example to add tab with toolbar. I took a look at http://blog.ostebaronen.dk/2013/11/getting-support-v7-working-with.html

Show Dialog Fragment in Fragment

How show MvxDialogFragment in MvxFragment. Can not use FragmentMaganer and other solution. No Work public void ShowFragmentLatestInvoices() { var transaction = FragmentManager.BeginTransaction(); var Manager = FragmentManager.BeginTransaction (); LatestInvoicesFragment LatestInvoicesFragment = new LatestInvoicesFragment(); LatestInvoicesFragment.DataContext = ViewModel.InvoiceVM; LatestInvoicesFragment.Show(SupportFragmentManager, "LatestInvoices_fragment"); OnAttachFragment (LatestInvoices); } ...

The runtime version supported by this application is unavailable during app startup

I'm getting the following lines on app startup. Application works fine though: Jun 22 18:29:54 Alexeys-iPod-touch xxx[1169] : WARNING: The runtime version supported by this application is unavailable. Jun 22 18:29:54 Alexeys-iPod-touch xxx[1169] : Using default runtime: v4.0.30319 What should I do about it (and should I)?...

Is there any way to use a pre-existing database from Xamarin without copying it from Assets?

I have a rather large SQLite database (~20 mb) I need to access from my Android Xamarin-Forms app. Everything online I've read says you can read the database by copying it to the filesystem first. For example, this question. However, won't that mean the large database is duplicated, wasting users'...

Exception when launching activity from PreferenceScreen

I'd like to launch an activity from a preference screen. This already did work in the past and I haven't changed any code but updated the Android SDK (updated packages and installed new ones) and since then it doesn't work anymore. I get an exception that the activity could not...

How can I use animation in xamarin android application?

I want to use animation in my android Application using Xamarin C#. animations like fade-in, zoom-in, move and ....

Geocoder class gives wrong coordinates and won't parse coordinates to get street address. Xamarin

I typed in the code from http://developer.xamarin.com/recipes/android/os_device_resources/gps/get_current_device_location/ and I keep getting the coordinates for the Xamarin office in San Francisco as my current location when I run the app. I have installed the Google Maps apk on my Nexus 4 (KitKat) API 19 emulator and Google Maps displays my current...

WPF use one ViewModel for multiple UserControls

I've searched a lot for an answer for this question, but couldn't quite find an answer. I have my main Window and 4 different UserControls. The Window is constructed from all 4 UserControls. I have a class which is the Window's ViewModel. I wish to set the DataContext of the...

Xamarin.Forms: GroupHeaderTemplate is not visible, neither are the items but seems to partially render

I have a GroupHeaderTemplate in Xamarin.Forms for a ListView element which is not rendering. You can select the headers, and pull up the quick menu. I can successfully render the groups if I use the property of the ListView element GroupDisplayBinding, yet when I specify GroupHeaderTemplate property of ListView nothing...

How to 'await' a listener properly? Replacing a hacky spin-lock solution

I am working on a xamarin project with a partner. Xamarin allows the use of C# in coding for iOS or Android. Here is an example of some code a coworker wrote that I feel could be done in a substantially better way: alert = new AlertDialog.Builder (Act); alert.SetOnDismissListener(new OnDismissListener(()...

Uploading an IMG file through RestSharp

I have the code: request.AddFile ("image_request[image]", ("picture.jpg"); The "image_request[image]" is required for the specific API. The "picture.jpg" is in my /resources/ folder and correctly works. However, with my application, I do not have a file stored locally. I take a picture with the camera app and have it stored as...

Xamarin: How to print from Android device to dot matrix printer?

I have the following hardware: Dot matrix printer: LX 300-II. Android device with Android version 4.2.2. Connection type: USB, Wi-FI, Bluetooth. I have an Android Activity that create an invoice, so I want to print some text on printer. But I can't make it work. I tried using USBManager with...

How to install Xamarin for Visual Studio 2015 when Visual Studio 2013 is installed too?

I install both Visual Studio 2013 and 2015. I need install Xamarin for VS 2015. But I can't do it because by default it's installing for VS 2013.

Recyler view listitem image onclick

I am working on xamarin android apps. I used recycler view for displaying the images in each row. Now for each item image there is some link which I need to redirect. How can I achieve this onclick action for each image in recycler view. Please help me in this...

Xamarin.Forms Maps crashing app

I'm having a hard time trying to show a map on my Xamarin Forms app. This is the error I get everytime I open the page with the map: 0x29 in System.Diagnostics.Debugger.Mono_UnhandledException_internal C# 0x1 in System.Diagnostics.Debugger.Mono_UnhandledException C# 0x6 in Android.Runtime.UncaughtExceptionHandler.UncaughtException at /Users/builder/data/lanes/monodroid-mavericks-monodroid-5.1-series/d23da369/source/monodroid/src/Mono.Android/src/Runtime/UncaughtExceptionHandler.cs:35,4 C# 0x1C in...

Xamarin App crashes on Reopen NullReference

I have an app on Xamarin, it works fine, if I press back button, to move to main menu it hides in app stack, so when I open it back from app stack it suddenly crashes with NullReference 06-10 15:59:57.363 I/MonoDroid(14891): UNHANDLED EXCEPTION: 06-10 15:59:57.363 I/MonoDroid(14891): System.NullReferenceException: Object reference not...

No valid iPhone code signing keys found in keychain in xamarin

I have a Xamarin project in which I am getting Error: No valid iPhone code signing keys found in keychain.. As suggested in this question, I have set Configurations Mappings from iPhone to iPhoneSimulator. And its done as evident in the Build Output. Here is the screenshot: (Dont have enough...

Expanding the size of ListView cell on tap

I'm trying to implement a solution to increase the size of a ListView Cell when tapped using Xamarin Forms (and custom renderers if required). I'm still pretty new to C#, and the idea of data binding is still a little unclear to me, however, it seems like that is the...

ServiceStack Authenticates both iOS Apps when one is logged in

I'm using the awesome ServiceStack to implement my REST backend which serves two iPhone apps written in Xamarin. Everything works great but i'm struggling in getting sessions to work correctly when the two apps are installed on the same device ! The issue is that if I login in one...