I have a question surrounding the PCL. From all that I read up it is my understanding that you can only use Prism.Forms with PCL, when the views are in the portable library (ie. the xaml views and not in the native libraries). Am I mistaken? Is there a way to use prism with native layouts?
I want to use Prism in my xamarin app but I want to create native layouts for Android & IOS. But I cannot figure out how to make Prism navigate from page to page and how to tie the ViewModel to the layout as there is no AutoWireup option in the native.
So it seems that Prism is a xaml only option?
Prism for Xamarin.Forms (Prism.Forms.dll) only supports Xamarin.Forms. It does not support Native Xamarin iOS or Android.
Hi asked this same question on Brain Lagunas blog and he aswered me back:
Prism.Forms only worlks with Xamarin.Forms, it doesn’t work for Native Xamarin for iOS or Android.
Thanks Brain
Related
I tried searching for this everywhere, but I cannot find any solution.
I also tried looking at solution properties, project properties, visual studio preferences, Visual Studio extensions, change XAML xmlns definitions but I have no clue why this is not possible, and I think it should be standard simple functionality.
When you create a new Xamarin.Forms project that includes
, you would suspect that there is not only a way to see your XAML design on Android and iOS but also for any Windows platform you are targeting, such as W10 Desktop but also other Windows platforms that UWP supports and that supposedly Xamarin. Forms do support according to the website from Microsoft. You can easily build your project for these platforms, no problem. But I want to see what I am doing before I compile my work.
When opening your XAML design, instead of a simple Android / iOS and Windows tab in the design panel, Windows is nowhere to be found.
How am I supposed to see how my Windows screen is going to look without an option to see this? In WPF and plain UWP, this works fine, but somehow for Xamarin it only shows Android/IOS, but apparently, Xamarin has full support for Windows (desktop).
I am looking for multi-platform support to create a windows desktop application that is easily portable to iOS and Android. I thought Xamarin could do that, but if I am not able to see what I am doing on Windows in terms of layout, how am I supposed to develop a solid UI for the platform?
I am probably missing some kind of checkbox somewhere (I am hoping), but I cannot find any information about this. Yes, I tried to google. And Stack overflow. And Xamarin documentation from Microsoft. And watch YouTube videos about Xamarin for 20 minutes that supposed to explain the Xamarin multi-platform support. And after 20 minutes I find they only specifically explain iOS/Android but nothing about Windows. So yeah, getting pretty tired of searching and hope someone can be kind enough to help me out.
This is a limitation of Xamarin.Forms. Although it uses XAML, it has a custom XAML dialect which is not compatible with WPF/UWP, so the built-in UWP designer cannot handle it directly and it will require a custom designer implementation.
But if you want a first-class Windows development experience compatible with Android, iOS and even WebAssembly, try looking into the Uno Platform. This is a UWP bridge with full XAML compatibility with UWP XAML, so your app will look exactly the same on all platforms and provides full templating and styling support. In addition, Uno Platform provides bridge for many non-UI APIs as well, including things like Clipboard, Accelerometer and so on. In the end you will be able to just write a Windows app which will work everywhere with minimal changes.
You can use XAML adaptive triggers to make sure the app works well on each screen size and scales great from desktop to mobile.
If you want desktop version of you app just add UWP or WPF blank project to your solution.
For UWP it goes like this:
https://learn.microsoft.com/en-us/xamarin/xamarin-forms/platform/windows/installation/
For WPF it goes like this:
https://learn.microsoft.com/en-us/xamarin/xamarin-forms/platform/other/wpf
Right click on your "Project.UWP" or "Project.WPF" project and pick "Set as Startup Project"
and building your solution.
I'm totally new in xamarin.
I'm trying to use CoreNFC in my xamarin.forms multiplatform app.
But I don't know how to do it because i can only import CoreNfc in myapp.ios and not in myapp.
There is someone that know how to do it ?
Thanks in advance!
Core NFC belongs to the iOS Framework, so you can import and use it only in our iOS Project.
You could implement the NFC feature on each platform you want to support and use a interface and the Xamarin Dependency Service, to have access to these platform specific implementations in your shared code.
Or you look around for a plugin which did this work for you. A starting point could be NFCForms from poz1. But if I remember well it has so far only support for Android and Windows Phone.
I have an app developed for windows 10 on C# and now I want to move to IOS and Android. I have heard of xamarin and used some of there stuff in C# but would it be possible to embed the C# code and move it to apple xcode without having to redevelop the app from again?
would it be possible to embed the C# code and move it to apple xcode without having to redevelop the app from again?
No, it is not possible. Basically you can share some UIs across different platforms, but I think redevelop your app for each platform is necessary.
Not sure if you want to use Xamarin.Android and Xamarin.iOS or Xamarin.Forms to develop your app, you can use C# for development by using Xamarin, it provides a cross-platform implementation of the extensive features in .Net framework, but the actual implementation on each system is very different. For more information, you can refer to Understanding the Xamarin Mobile Platform.
For Xamarin.Android and Xamarin.iOS, you can refer to Android Architecture and iOS Architecture.
For Xamarin.Forms, you can have your UIs and some basic features designed in the PCL in order to share across different platforms, but for most features just for example like working with files, we need to access the native method of each platform, therefor, Xamarin.Forms provides a locator named DependencyService to achieve this.
I am new to Xamarin, but learning quickly. I have what is hopefully a straightforward question. I know that I can customize Xamarin Forms controls per platform using custom renderers, and I also know that I can use native controls that have 0-param constructors with dependency service.
my question is, how do I use a native control (specifically Android ImageView... and eventually obviously WinPhone and iOS counterparts) in my Xamarin Forms PCL app?
A very simple example would go a long way, since I'm just having trouble getting my head around how I would define an interface which would set parameters like buffering, image source, etc. on the platform-specific controls.
Thanks for your help!
With the latest update to Xamarin Forms this is a newly added feature.
You can read more about it in the blog - Embedding Native Controls into Xamarin.Forms.
Also you can find samples at Native Embedding - Adding Platform-Specific Controls to a Xamarin.Forms Layout
On Android, the following code example demonstrates how to add a TextView to a StackLayout and a ContentView:
var textView = new TextView (Forms.Context) { Text = originalText, TextSize = 14 };
stackLayout.Children.Add (textView);
contentView.Content = textView.ToView();
For this to work you have to use a Shared Project template and not PCL. For PCL you will have to use Custom Renders.
I have followed this article here:
http://blogs.msdn.com/b/eternalcoding/archive/2013/10/29/how-to-use-specific-winrt-api-from-desktop-apps-capturing-a-photo-using-your-webcam-into-a-wpf-app.aspx
And it all works great... but how do I get a preview in WPF?
The XAML "CaptureElement" control is not available in WPF. Is there any other way I can get a preview using the MediaCapture API?
Why would Microsoft not make this control Available?
Late reply, but in case that helps folks in the future: previewing MediaCapture in WPF is difficult but possible. Here is some code sample:
https://github.com/mmaitre314/MediaCaptureWPF
After investigating further it seems impossible to get this to work with the XAML Capture Element or any other XAML element in WPF.
I decided to port my WPF app to a Win8 application. I kept the existing back end code and referenced it using a Brokered WinRT Component. An excellent tutorial can be found here: http://devhawk.net/2014/04/25/brokered-winrt-components-step-one/ on how to create a WinRT brokered component.
Keep in mind that the app must be sideloaded and will not work for apps that you want to publish to the store.
You will have to rig up a mechanism to display the converted BitmapImage yourself, e.g., either in an Image control or as an ImageBrush on some surface. To the best of my knowledge, WinRT controls cannot be hosted in WPF.
CaptureElement was presumably not ported to WPF because it depends on WinRT APIs, and it makes little sense to introduce a dependency into WPF for an API that is only available on Windows 8+, and which is only officially supported in Windows Store apps.