Xamarin create masterdetailpage with multiple detail view using axml(android) - c#

I'm new to Xamarin framework and developing an application for both iOS and Droid shared application.
I just wanted to make a left slider menu like android normal app using Masterdetailpage layout with axml. I couldn't find the proper example or stub for it to develop an structural programming in Android.
It would be great help If anyone can suggest any answer.

Related

Using Native Page in Xamarin Cross Platform Application

I have Xamarin Cross Platform Application in Visual Studio 2022. I have a Main Page where i want 2 buttons.
"Take me to Android Page" Button
"Take me to iOS Page" Button
I want to create a sample NATIVE page specifically in Android Project of this Cross Platform Application and one sample NATIVE page specifically in iOS Project within this Xamarin Cross Platform Application.
When I will click on "Take me to Android Page Button", it should take me to Natively designed Page of Android and when I will click on "Take me to iOS Page Button" then it should take me to Natively designed page in iOS Project.
I hope anyone can give me any reference or sample codes to achieve this goal.
Thank You
Xamarin.Forms is designed to prevent the need to design each page for both platforms by using XAML to define shared layouts rendered at runtime using native controls. If you can expand your question to include reasons why you need to define fully native page layouts for each platform, that will help better inform answerers.
If you need the ability to create custom controls for each platform, consider custom renderers which will allow you to define platform-specific behavior for individual views in your XAML pages.
When I will click on "Take me to Android Page Button", it should take
me to Natively designed Page of Android and when I will click on "Take
me to iOS Page Button" then it should take me to Natively designed
page in iOS Project.
You can first find out what Xamarin Forms is and how it works.
From document What is Xamarin.Forms?,we know:
Xamarin.Forms is an open-source UI framework. Xamarin.Forms allows
developers to build Xamarin.Android, Xamarin.iOS, and Windows
applications from a single shared codebase.
Xamarin.Forms allows developers to create user interfaces in XAML with
code-behind in C#. These interfaces are rendered as performant native
controls on each platform.
And part Who Xamarin.Forms is for mentions that :
Xamarin.Forms is for developers with the following goals:
Share UI layout and design across platforms
Share code, test and business logic across platforms.
Write cross-platform apps in C# with Visual Studio.
So, the requirement you mentioned above is not invalid.
In addition,if you want to use native controls of the target platform in xamarin forms, you can use Xamarin.Forms Custom Renderers to achieve this.
Xamarin.Forms user interfaces are rendered using the native controls
of the target platform, allowing Xamarin.Forms applications to retain
the appropriate look and feel for each platform. Custom Renderers let
developers override this process to customize the appearance and
behavior of Xamarin.Forms controls on each platform.
Note:
We have Payment Gateway SDK for Android specific only that's why we
need to use Native forms. Can you suggest or give me some hint how we
can use them ?
Xamarin.Android offers two ways to use these libraries:
1. Create a Bindings Library that automatically wraps the library with
C# wrappers so you can invoke Java code via C# calls.
2. Use the Java Native Interface (JNI) to invoke calls in Java library
code directly. JNI is a programming framework that enables Java code
to call and be called by native applications or libraries.
For more details, check: https://learn.microsoft.com/en-us/xamarin/android/platform/binding-java-library/ .

How can I render .obj model in Xamarin.Forms?

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!

SwipeListView in Xamarin Form

I am working on android application using xamarin forms. We have a list that is displaying items. Client want to delete the item on swipe, "left to right" vice versa . I have a link that is working for xamarin android that i am share with you Click here . I need same thing for Xamarin form. If anybody have any idea please share with me. Thank you.
Currently the Xamarin Forms support only a specific set of gestures.
Those are Pan, Tap and Pich. It does not support Swipe.
You can go and create these events in your native projects and expose via a Renderer.
Or you can use the MR.Gestures which has all the events you need.
The XLabs project has gestures, which you can use. More discussion about it can be found in this forum thread.
This a good tutorial - Gesture Recognizers with Xamarin.Forms you can look into if you are trying to build your own gesture recognizes.
There is 2 good solutions provided to this SO Question - Xamarin Forms Swipe Left/Swipe Right Gestures.

Native Page in Xamarin.Forms

I apologize in advance for my question, but I start with Xamarin and need help to create a particular architecture.
I should use Xamarin forms with MVVM Light , but with a large part of native pages (UWP).
For this, I wondered if I had to place my View-Models in the portable class or in the UWP Project ? And if in the portable class, what navigation use to navigate between my native pages ?
The Logic should be placed inside the shared code so put your ViewModels inside the portable or shared project.
For navigation between pages you could use:
conditional compilation
if mobile
navigation droid/iOS
else
navigation UWP
(Use with underscores, entering here is using formatting, see link
Condotional Compilation for more details)
DependencyService as described here DependencyService
I'm sure there are other ways but I think DependencyService is the most elegant, as those #if#else stuff makes the code confusing and unreadable.

Is there a xamarin component that will handle PIN entry?

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

Categories