How to Hide Hamburger Menu icon in Xamarin forms - xamarin

I need to hide the hamburger menu on certain pages but still hamburger menu icon is visible in some of the pages . I have a tried a possible ways but nothing helped us. And I attached a image for your Reference.
Possible case I tried so far:
In Xaml Page
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
BackgroundColor="#F8F8F8"
NavigationPage.HasBackButton="False">
</ContentPage>
Xaml.cs (Code Behind)
I put the code in constructor, and this also not helped
NavigationPage.SetHasBackButton(this, false);
And I used ShouldShowToolbarButton in Flyout Page also ,
public static bool showIcon;
public override bool ShouldShowToolbarButton()
{
return showIcon;
}
I tried possible combinations but hamburger icon is still visible only. Most probably am facing this issue in Android
Please give your valuable suggestions.

Related

Looking for why my code is not registering the binding for xamarin forms for pulling an image from one page and placing it on the button

So basically i placed a binding in the source for an image button in xamarin and i am trying to pull an image from another page in the app and replace the current source for the image button.
I have tried the following code for setting up the binding in xamarin:
<xct:AvatarView BackgroundColor="Transparent" Scale=".3" Source="{Binding Image1}" TranslationX="150" TranslationY="-150" x:Name="Emote1"/>
This will call the binding and designate what will be there:
public string Image1 { get; set; }
And the image should be taking the image from the page on the app and adding it to another page:
I have tried switching around some of the variables but i have not found a good solution any help would be great I am using Visual Studios btw

Can I put another ContentPage in ContentPage inside TabbedPage?

I have TabbedPage. This has multiple ContentPages inside.
E.g; I have a settings page, I want a new page to be opened by clicking a button in the settings page, hiding the tab part.
When I do as below, the new page is gone, but I have to re-create the TabbedPage to return. Is it possible to create a new page in view with tabbedPage hidden in the background? Can you help if possible?
Application.Current.MainPage = new NavigationPage(new PageTrial());
I'm new to Xamarin sorry if it's a simple rendering.
Original Poster (OP) said Jason's suggestion of Modal page solves their need.

how to set focus at specific position in Entry + xamarin.forms

my entry box has some text already.so can I set cursor focus at start of text?
how? I coudnt find any option for that.if anybody have idea.please suggest.
As you said
In mobile app there wont be focus in load of page.as there will not
keyboard open first.. once user clicks on text than keybopard will get
open.so wherever he click focus will be there?
In mobile app On load focus depend on the requirement. Check out most luxurious android app linkedIn login page, have focus in Username Entry without opening keypad. If you want to avoid using custom renderers in XF than you have to do bit compromise with functionality.
Your second point true- Wherever user clicks focus would be there.
Try doing like this, First update Xamarin.Forms version to 3.1.0.697729 from nuget packages & target framework change to Oreo 8.1.
XAML file
<StackLayout>
<Entry x:Name="txtDummy" HorizontalOptions="Center" VerticalOptions="CenterAndExpand" />
</StackLayout>
your .cs file
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
protected override void OnAppearing()
{
txtDummy.Text = "I am focus";
txtDummy.Focus();
base.OnAppearing();
}
}
Look at output screenshot

How to show Menu in MasterDetail Page when using Prism and Custom Title bar

I am completely new to Xamarin.
I am working on a project where Prism framework is used for navigation (my first xamarin project) The requirement needed a custom title bar. I have implemented it as detailed out in this tutorial
https://wolfprogrammer.com/2016/07/07/custom-app-header-in-forms/
Now with prism navigation, how to show the masterdetail page menu i.e. set the IsPresented property of MasterPage to true when the user clicks the custom hamburger icon.
I have been reading about this for hours now and not able to understand any of the solutions mentioned nor are they working for me? Could someone please break it down for a complete beginner here?
Some links that I have referred so far
https://forums.xamarin.com/discussion/93409/prism-how-show-hide-programmatically-the-masterdetailpage-menu
https://github.com/PrismLibrary/Prism/issues/570
Just have a boolean property in your Master page's ViewModel, let's call it IsMenuPresented, then in your MasterPage XAML:
<MasterDetailPage
x:Class="YourProject.Views.MasterPage"
...
MasterBehavior="Popover"
IsPresented="{Binding IsMenuPresented, Mode=TwoWay}">
If you want to be able to toggle the menu from code, you can either:
1) do something like
(App.Current.MainPage is MasterDetailPage mainPage).IsPresented = true;
2) Use Prism's Event Aggregator to subscribe to an event in the Master Page's ViewModel that will listen for a true/false value that gets published from some other ViewModel and set IsMenuPresented accordingly (thereby showing/hiding the menu).

Xamarin.Forms - How to disable Tab on TabbedPage?

I'm looking for a way to disable a tab within a TabbedPage. The tab should be still showing up in the TabbedPage header but simply be disabled.
I tried to set the Page to IsEnabled = false but apparently this is not how you do it or I did it wrong. :)
You can create a custom renderer for a tabbed page control and disable user interaction in your platform specific implementation of the renderer.
For example your renderer for iOS would use the UITabBarControllerDelegate Protocol to override
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController
and return NO for the tab that should not be selectable. The solution for Android or Windows Phone would work similar.
Here is my self-contained take on #joeriks method, which is a nice quick/simple solution. Annoying that the event args are just EventArgs.
Just add this to your TabbedPage .cs file somewhere.
Page _lastKnownPage;
protected override void OnCurrentPageChanged()
{
base.OnCurrentPageChanged();
if (CurrentPage.IsEnabled)
_lastKnownPage = CurrentPage;
else
CurrentPage = _lastKnownPage;
}

Resources