I've just started looking at how I can generate and port applications to Android and IOS, I've started to look at Xamarin. First, I'm looking to generate custom UI control of a 10x10 Matrix (checkerboard - each square is a different colour) with each square being able to be selected and a specific image being displayed.
After looking at the documents and looking at MVVM examples, I'm not entirely sure what the best method of doing this : How should I structure the code (should I use just SVG drawing) or is there a better method of doing this in Android and IOS ?
To be honest I would start with Xamarin Forms and create a grid control with 10x10 image buttons. This way you get the event handling built-in. This would work for iOS, Android & Windows Phone out of the box. From there you could evolve it to more native specific code if necessary.
If you want to control the look pixel perfect then creating native custom rendered views would be the option but this is much more work of course so I would not start there. On Android you would subclass from Android.Widget.View and on iOS you would do it from MonoTouch.UIKit.UIView. For both you would override the Draw method.
Related
I have a .obj file that has a 3D body in it and I want to render it in a Xamarin.Forms app that already exists(made with MvvmCross), so I just want to create a new ContentPage that has the rendered body. The user should be able to view the body from different perspectives and maybe click on it to highlight some parts, but that's it.
I found out about UrhoSharp and I also know that I can use Metal and Vulkan bindings for Xamarin, but as I'm a beginner in 3D apps I don't know which one would be best for my scenario, that's why I would like someone to point me in the right direction for this scenario. For UrhoSharp I found this loader which only works on Windows 10, the Android app doesn't load anything and the iOS app renders the body but I can't move the camera around it.
Xamarin forms is good for making apps that are like "Forms" in which you fill out some information and submit.
The best way to do more 3D work is using Xamarin Native, Unity or if you want it to be a small part of your Xamarin Forms app, you can simply create a Custom 3D Renderer in Xamarin Forms.
The beauty of Xamarin is that you can access all the native APIs, so you would just follow tutorials on using the native APIs to access those OBJ files. For iOS, you would just be looking for a tutorial on how to use ARKit and then make small tweaks to add the obj file like this.
Do the same thing for android!
I've created my HoloLens application from the "Holographic DirectX 11 App (Universal Windows)" template. When I start the app, it shows a slate (a 2D window) in the HoloLens and I need to place it in the space. Then my app will work as a hologram (in an immersive view).
Before going to the immersive view, I want to check some conditions and show a message to the user, if the application cannot start.
Currently, my app does not have any XAML code.
It uses SharpDX library.
Can I write some text on the slate window?
I understand that this is an old question, but I will answer just in case somebody else needs to do something similar.
There are two possible ways to do that:
1) Perhaps the easiest way is to start your app as a XAML app and then, if everything is alright, to switch to DirectX mode, otherwise write your message on the main XAML window of the app. You could also provide a "Go Holographic" button for the user. There is a very good blog post here by Jonathan Antoine, which explains how to perform the switch between XAML and Holographic mode in detail- it also provides the source code
2) Another solution is to write your text to a DirectX texture and then paint that texture onto a rectangle in the 3D immersive mode. But that one is probably not exactly what you want since you'll need to switch to Holographic mode first and it is a fair amount of work
I am new to Xamarin, and am setting up a Xamarin Forms app, and triggering the device's camera after creating the intent and starting an activity for it.
Pretty much what Xamarin's recipe looks like, but I am using Forms.Context as the Activity object (in order to place all the hookings inside my content page, as opposed to having everything within MainActivity.cs, as in Xamarin's recipe).
It works, the camera is opened.
Intent intent = new Intent(MediaStore.ActionImageCapture);
_file = new File(_dir, String.Format("myPhoto_{0}.jpg", Guid.NewGuid()));
intent.PutExtra(MediaStore.ExtraOutput, Uri.FromFile(_file));
Forms.Context.StartActivity(intent, Bundle.Empty);
The thing is I want the same as the recipe's feature of putting the picture just taken into an ImageView.
The recipe's code generates the UI (and everything else) within MainActivity.cs. I wanted to keep the view declared separately, in its XAML file.
As far as I understand, I need to be able to embed a axml android resource file into the xaml, because code in MainActivity is already Android-ported, and Android can reference views/controls only by their resource id (which are automatically generated after creating the view/ui container as an axml file under Resources/layout folder.
How do I complete this last step in order to have the Take a Picture sample working - coded outside the MainActivity?
Screenshots:
Here's how the Xamarin recipe puts the picture taken into the image viewer.
if you are working with Xamarin Forms and want to take a picture and then display it with an Image - I suggest you use https://github.com/jamesmontemagno/MediaPlugin which allows to let the user take a photo (or pick one from the phone). The result can be set as the ImageSource of an Image.
About the original question, whether you can embedd a native android element into xamarin Forms - you can check out https://developer.xamarin.com/guides/xamarin-forms/user-interface/layouts/add-platform-controls/
I think the right way to deal this is to use DependencyService to access Android native feature, to be specific here, to call the native method of taking a picture and save the picture. If you just want take a picture and display it with Image, you can use DependencyService to implement this platform specific feature and design your layout in xaml, there is no need to embed axml in XAML.
If you want to embed the camera preview in Xaml, the suggested way is to use Custom Renderers to render the interface using the native controls of target platform. It means, you don't need to create a axml in Android project to display camera preview, you can create a custom renderer (control/ view) in PCL, and implement this control in your Android project. There is official doc and demo which guides us to implement a view to display the camera preview.
I see there is an iOS and iPad, PIN Code Control xamarin component, that will give your a programmatic numeric keypad for PIN Entry. Short of coding the entire thing using C# in Xamarin I would prefer to find a component.
I need a PIN code control, xamarin component that is cross platform, which is the purpose of xamarin forms. We will be using this on Android and iOS devices.
Has anyone see such a component on Xamarin's Component Store and I am using the wrong search terms, PIN, Keypad, Numeric?
For future googlers: you might be interested in a small Xamarin.Forms library XamarinFormsPinView. I'm the author.
It's not very configurable, but should fill most common requirements.
Sorry, I have not seen a component that does what you need.
This Xamarin.Forms calculator sample might be a useful starting point for writing a custom one (since it already implements a numeric keyboard entry with display and backspace).
Obviously there's a lot of styling work required to get it looking like any of the native PIN entry screens - but it should save you writing from scratch.
If you need attractive xamarin forms pin passcode form with high control, check out this repo. It is not a library and it does not use MVVM models. It is just .XAML page with code behind it.
https://github.com/Akezh/XamarinFormsPinPassword
I`m trying to make an windows phone 8 app which simply allow you to click a button which result in start recording and showing any visualization that indicate that its recording something like a bar or a vu meter , I managed to make the recording part, now i dont know what type of projects i should use to support making such visualization.
does Windows phone 8 apps support using XNA to draw in a box inside a xaml file ?
what is the tag i can use to draw inside using XNA code ?
If you're targeting WP8 you can't use the hybrid SL/XNA model. That said, you can certainly use a Hybrid solution that draws using DirectX. You can find general information here and a sample here (note that it uses DrawingSurfaceBackgroundGrid, you probably want DrawingSurface).