Xamarin forms iOS default mail app Behavior - xamarin

As per the requirement of the project I need to have the page which should behave as the default Apple Mail app on the iPhone.
Attaching a gif that I have created for the same.
I tried using the plug in https://github.com/rotorgames/Rg.Plugins.Popup
but I couldn't achieve the exact same behavior where the background shrinks and expands as the modal pop up is dragged.Any leads, examples or demos will be really helpful.
Note: I am using Xamarin.Forms.

With the new Xamain Forms update. i.e. after iOS13
The model behavior has became the default model behavior for Xamarin iOS.
When you do.
Navigation.PushModalAsyn(<your_page_here>).
It gives the above (gif) behavior.

Related

Enforcing theme for a particular Xamarin application

In my Xamarin project (Xamarin 4.8) there are many pages with complex structure. Also there are many bitmap resources, designed for white backgrounds etc.
When user sets Dark theme on the iOS, appearance of pages become weird and unusable. On Android the application looks as nothing was changed.
For now I have no time, to set manually color properties on every control on every page and I would like to enforce light theme for the application (Android and iOS platforms), to get a time to redesign the whole application later.
In an article I read that Xamarin 5 offers a way, putting this line of code into Application class:
App.Current.UserAppTheme = OSAppTheme.Light;
I tried this way (migrated project to Xamarin 5 and called this code), but it does not work. Application on iOS in the Dark theme looks unusable.
What options do I have on this point? Is there a relatively simple way to enforce Light theme for iOS applications?
As advised by #SushiHangover and #JackHua-MSFT into this answer I used the following approach and it worked (XCode 12.3):
Into the plist.info I should add the key UIUserInterfaceStyle with value Light. And that enforces Light theme for the application, regardless of what theme is set for the device.
Final xml code, that I added to plist.info looks like that:
<key>UIUserInterfaceStyle</key>
<string>Light</string>

Xamarin.Forms UWP Application doesn't work on XBOX as native

I have tried my UWP app on XBOX one which is built using xamarin.forms and it works generally fine but by default mouse mode is active. I changed it using
RequiresPointerMode = Windows.UI.Xaml.ApplicationRequiresPointerMode.WhenRequested;
on UWP level in app.xaml.cs and it disabled mouse pointer but problem is that using game pad, i am not able to select items on the UI. I can navigate through textbox and buttons but not Toolbar (Commandbar in uwp), ListView, Masterdetail, Tabs etc.
I created a blank native UWP application and added a commandbar with AppBarButtons and NavigationView with NavigationViewItems. It perfectly works, I am able to navigate between menu items and commanbaritems using mouse pad.
Why this is not working for Xamarin.Forms? is xamarin.forms not actually native for UWP?
Xamarin.Forms MasterDetailPage was written before NavigationView existed and it doesn't use it at all (and especially not with NavigationViewItems, that would limit the flexibility, i don't think it will ever be used).
As SplitView has some focus bug that I can confirm it doesn't come as a surprise that it doesn't work with XBox as expected. However UWP doesn't grant that the app will work properly when you disable the mouse mode with native controls, that's why it is enabled by default. There are properties like XYFocusLeft that must be set if the app is not working properly. You probably need to make custom renderer to expose those properties and set them right. That's pretty much of work to do but it is up to you to decide...

Bind/set short text data from Android MainActivity.cs to a shared Xamarin Forms Label?

Is there a way to define a Label in Xamarin Forms (XAML or code-behind) AppXYZ that can be updated from the Xamarin Android AppXYZ.Android: MainActivity.cs and AppXYZ.iOS:Main.cs? i.e. upon an event in Android (e.g. BlueTooth) set a short text in a common Forms elements? After viewing many example, no clarity yet. MessageCenter perhaps?
In Android Project: MainActivity.cs (for example):
FormsAppXYZ.LabelXYZ.Text = "Updated string";
If not possible, then proper way to do this with Xamarin Android Native ? appreciated since I'll have to mix in the label into a shared Xamarin Forms Tabbed GUI.
Depending on how much Bluetooth work you need to do, my first suggestion would be to use MessagingCenter as you have already alluded to.
The other obvious approach would be to use a third party plugin, as I don't believe Xamarin have released one. I am currently aware of these two:
https://github.com/aritchie/bluetoothle
https://github.com/xabre/xamarin-bluetooth-le

Xamarin - mixing Forms and Storyboards

Is it possible to mix iOS Storyboards and Xamarin Forms within one application? I have a bunch of views that are easier to be created in Forms, but some which are heavily customized so we would need to create some of them in native code.
I would like to use Storyboards to create the native parts, but can't seem to find a way to navigate from a Forms page to a Storyboard and vice versa.
I don't mind doing it from code, just need to know the direction to look into and if it's even possible.
You can create native views using the concept of Custom Renderers (see links below). The idea is that you create a Xamarin Forms Control that's shared between all platforms and which old common properties (like colors, general data etc), and do the native rendering on the iOS/Android/WP projects.
So, for your storyboard, you can create it usign Xamarin.iOS, and render using a Custom Renderer. The link posted by #GSerg in the comments have some information and examples, but you can take a closer look at the oficial documentation as well:
Introduction to Custom Renderers
Customizing Controls on Each Platform
Customizing Control Rendering in Xamarin.Forms (video)
Also, for more real world examples you can take a look at the Xamarin Forms XLabs project.
Thanks to Rafael Steil's answer. I looked at the links and a few more samples.
Notably:
Custom Renderer Map
Using Xamarin Forms alongside Storyboard
And I created a sample project to show the back-and-forth navigation between Xamarin Forms and pages created in Storyboards. You can find it over here:
Xamarin Forms Mixed with Native

Difficulty while writing custom renderer for navigation drawer(MasterDetailPage) xamarin.forms

I am using xamarin.forms mvvm light architecture and targeting Android & iOS.
I am currently writing custom renderer for navigation drawer(MasterDetailPage).
I am currently writing custom renderer for Android and i have tried many things.
Currently my MasterDetail Page renders according to OS's default behaviour i.e. in Android master page starts below the app bar but i wanted my master page to popover app bar or start above the app bar like gmail,stack exchange android app etc
use this theme Theme.AppCompat.Light.NoActionBar for the expected behaviour
There exists one already, as of this writing it is out of date though (not targeting Xamarin Forms 2): https://github.com/nativecode-dev/oss-xamarin. Perhaps you can use that?

Resources