I wanted to ask if it was possible to insert in Xamarin a ToolBar on two or more lines and, if possible, also how to change the background color.
Thanks
You can customize the toolbar using the <NavigationPage.TitleView>
Here is the Microsoft Documentation
And a blogpost where it mentions a multi-line toolbar
And you can modify the color of the toolbar using the BarBackgroundColor (you can do it from your App.xaml.cs
MainPage = new NavigationPage(new FlagDetailsPage()) { BarBackgroundColor=Color.Black };
Related
I have a Xamarin Forms app, where I have a CollectionView of Frames. What I want to add now in this view is a TabbedPage, so that the screen in split in half (using Grid) and the left side has the CollectionView and the right side has the TabbedPage.
I tried to create a TabbedPage in a separate xaml file and then add that to my MainPage (where the CollectionView is as well), inside the grid to set its location, but I get the error that this is not possible. Only ContentViews can be set like this.
Does anyone know how to do this?
Thanks to Juan Sturla, the solution was to use the Xamarin Community Toolkit, that can be found here:
https://learn.microsoft.com/en-us/xamarin/community-toolkit/views/tabview
Is there any way I can place a ContentView or Grid to cover complete page in Xamarin.Forms?
I need to place it over the TitleBar area without hiding the TitleBar.
I tried to achieve the same using RelativeLayout but it is not working. I am trying to achieve something similar to a popup/modal.
Sadly I can't use any Third Party control in my project or PushModal either.
Ideas?
Adding the sample screen.
You could set in Xaml:
NavigationPage.HasNavigationBar = "False"
If you want to make the content whole page and without hiding the title bar, then you need to make the title bar transparant.Follow this tutorial https://xamgirl.com/transparent-navigation-bar-in-xamarin-forms/
or
If you are trying to achieve popup, consider using this wonderfull plugin https://github.com/rotorgames/Rg.Plugins.Popup
When using Prism 7+ as navigation framework in Xamarin Forms.
What would be most elegant way for changing the BarBackgroundColor of navigation page?
i Prism 6, there was a way for customizing navigation page using INavigationPageProvider , but that is no longer an option..
Ideally being able to change the color via binding to view model
In Prism 7+ you can register you own custom NavigationPage using the usual containerRegistry.RegisterForNavigation<MyNavigationPage>();
Your NavigationPage needs to be inherited from Xamarin.Forms.NavigationPage.
Of course you can set the backgroundcolor, bind to a ViewModel etc...
I'm adding ToolbarItems I need on all my other pages here.
Your first Navigation Action should look like this await NavigationService.NavigateAsync($"{nameof(MyNavigationPage)}/{nameof(MyFirstPage)}");
I am using Navigation View Controller in storyboard to creates different views linked together by segue link. Therefore, all the back button are automatically created.
I have tried many ways to customize that back button with other text, or just no text but still cannot.
Here are the methods I tried,
self.navigationItem.backBarButtonItem.title = #"abc";
or
self.navigationController.navigationItem.backBarButtonItem.title = #"abc";
or
self.navigationItem.title = #"abc";
Please help me this one, thank you a lot :)
You can edit the back button's title in storyboards directly. Select the appropriate ViewController that's been imbedded in a NavigationController and then:
I am attempting to reclaim some screen real estate in my application. I've got a search bar that is a basic QLineEdit and takes up space. In my menu bar, I easily have enough room to fit this search box, but I can't figure out how to get the LineEdit into the menubar.
Can someone assist me in getting this added to a menubar?
I am using Qt 4.7.
Here is an image of what I am attempting to accomplish. It's fairly basic image, but I'm looking to use the right half of the menubar as a search box.
Use QWidgetAction. QWidgetAction is for inserting custom widgets into action based containers, such as toolbars.
here is an example to add a progressbar to menu bar :
QWidgetAction *widgetAction = new QWidgetAction(this);
widgetAction->setDefaultWidget(new QProgressBar(this));
menubar.addAction(widgetAction);
You could use
void QMenuBar::setCornerWidget ( QWidget * widget, Qt::Corner corner = Qt::TopRightCorner )
to add your widget in the menu.