Reusing Navigation Bar font in Xamarin Forms - xamarin.forms

We need to add specific buttons to the left hand side of the NavigationBar in a Xamarin Forms View.
That is currently only supported via a TitleView because ContentPage.ContextItems all appear on the right hand side. TitleView means implementing the whole of the Navigation Bar.
I want my TitleView to look as close as possible to the platform specific Navigation Bar. Does anyone know how to get hold of the
Platform title font size
Platform foreground colour that would be used for the Title
I've tried all the NamedFont values and whilst they are close they aren't correct.
I have created a custom Label for used in the TitleView. Below are details of what I tried in the respective renderers
iOS:
I had hoped I could use UINavigationBar.UINavigationBarAppearance to obtain the right Font name, size and Color but I cannot get a populated instance of that. I have tried
UINavigationBar.AppearanceWhenContainedIn(typeof(UINavigationController))
but the Appearance class was not populated
Android
I have tried inflating the standard ActionBar layout and reusing the TextView in there but was unable to get that to work

Related

Howto make xamarin forms relayout if the size of my native control changes

I am working on a control deriving from Entry in xamarin forms with a native renderer for iOS and Android.
Depending on some options, the size of the control can change (there is a text line added or removed from the control).
This basically works as long as I do not do the size change of the control when it is already displayed.
When I do the size change when it is already displayed, the outer layout (in my test case a StackLayout) does not move the widgets accordingly. When the size is reduced, the free space is not taken by the next controls. When the size is expanded, the control is drawn below the next controls.
Can I somehow tell my custom control that its size has changed and that it has to be re-layouted on the page?

Editing the navigation controller from push segue

So i have a static tableview with 4 rows, i'm connecting them to different viewcontrollers without using any code instead i'm simply dragging the cell and setting up the segue.
The issue i'm having is that when this segue is performed a navigation controller is automatically generated and embed at the top so i get the following result below.
How could i edit the text and the icon? I want to remove the settings text and use my own custom icon.
It's also worth noting that i have embed other navigation controllers throughout my app. So i'd like to target this view specifically rather than all of my views.
I suspect the accepted answer on this question may help: how to replace/customize back button image in storyboard navigationcontroller
You'll need to do it in your prepareForSegue I believe.

Can we give different colors to buttons shown on alert box through DisplayAlert() method, in xamarin?

Can we give different colors to buttons shown on alert box through DisplayAlert() method, in Xamarin.Forms?
I can find its solution in android but I am unable to get in Xamarin.Forms.
It isn't possible. With DisplayActionSheet, you could only use one "Destructive" action which will be red on most of OSes.
You could write a custom version of alert box though. Here it's nice codebase for this: https://github.com/aritchie/userdialogs

Sencha Touch 2 adding buttons to toolbar/titlebars

Can anyone tell me how I might add buttons, or other components, to a title/tool bar without using the items array? For months I've been struggling to find a way to make the bar on all my views contain the same user buttons and icons.
It's a struggle mostly on List item detail views where only a back button shows. I want the back button but also own buttons on the same bar. This is so my app has a uniform look and accessible functionality across the entire build.
Toolbar and TitleBar extend Ext.Container.
In Sencha Touch containers always store their components inside the items array.
If you want to have a toolbar that always look the same just create your own by extending Ext.Toolbar. Use the initialize method of such extended Toolbar to add the buttons/icons.
To use it with a list you can create a wrapping container, which contains the extended toolbar and the list.

UINavigationController change position of pushed UIViewController view

I tried to solve this in so many ways but always failed.
Basically what I need is a NavigationController with a customized NavigationBar (different height and smaller back Button) which I already achieved.
This creats two problems. If I use the default NavigationBar of the NavigationController, I have a smaller NavigationBar but the views of the pushed ViewControllers still position as if the NavBar would have the usual height. If on the other hand I use my a self created NavBar and hide the default one, then the views of the pushed ViewControllers position as if I wouldn't have any NavBar at all. I don't know where to set the views frame. No matter where I try to set them, it doesn't work.
Is there any strategy without implementing an own NavigationController from scratch?
Not using nib files, dev for iphone OS 4.0 but will switch back to iphone OS 3 quite soon again.
Try using your own customized Navigation controller and setting the frame of the pushed view in its ViewWillAppear method.
Hiding the usual Navigation Controller will create problems. Its better NOT to use it completely if you do not intend to use it . But after doing that , you will have to use your customized Navigation controller in the project wheresoever.

Resources