I have successfully created my app and am finally ready to start testing before continuing with designs, however, while testing I find that after using my toolbar buttons twice it just disappears for no reason.
Here is the Xaml code for the item:
<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:pages="clr-namespace:ODDJOBS.Views"
x:Class="ODDJOBS.Views.TabbedAppPage">
<TabbedPage.ToolbarItems>
<ToolbarItem Text="ODDJOBS" Priority="1"></ToolbarItem>
<ToolbarItem Text="+" Priority="2" Command="{Binding NavigateToAddPageCommand}">
</ToolbarItem>
</TabbedPage.ToolbarItems>
<!--Pages can be added as references or inline-->
<pages:NextPage Title="Jobs"/>
<pages:ServiceView Title="Services"/>
</TabbedPage>
Related
I have a TabbedPage with 3 tabs, where I want to navigate directly to the 2nd content page (TagsListPage), but still keep my Tabbed header.
<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage
x:Class="BradyRfidDemo.V1.MobileApp.Views.TabbedInventoryPage"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:BradyRfidDemo.V1.MobileApp.Views"
Title=" SCAN PAGE"
Shell.NavBarIsVisible="false">
<local:InventoryPage />
<local:TagsListPage />
<local:Transfer />
</TabbedPage>
TagsListPage: (I removed most of the code to make it clean).
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
x:Class="BradyRfidDemo.V1.MobileApp.Views.TagList"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
Title="TAGLIST"
BackgroundColor="{StaticResource Color1}">
<ContentPage.Content>
<StackLayout >
<Frame >
<StackLayout
HorizontalOptions="Center"
Orientation="Horizontal"
VerticalOptions="Center">
<Label
x:Name="TagList"
Margin="0,10,0,0"
HorizontalTextAlignment="Center"
Text="TAGLIST" />
</StackLayout>
</Frame>
</StackLayout>
</ContentPage.Content>
</ContentPage>
So I want to access from another form content page, directly the TagsListPage, and keep my tabbed header.
If I go to the main page, I get my tabbed header, but it goes to the first page (InventoryPage)
Navigation.PushAsync(new TabbedInventoryPage());
If I go directly to the TagListPage, then I get my page, but not the tabbed structure which I need as well.
Navigation.PushAsync(new TagsListPage());
I tried a lot of different things, but nothing worked so far, and this looks like a very simple thing to do. Any help is greatly appreciated.
My xamarin andorid project does not have Drawawble folders under Resources, I have mipmap folders instead. I'm trying to set icon for a toolbar item in shared project. If I set an image as embeded resource I should be able to access it from the shared project, am I wrong?
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="BoringAppUi.MainPage" Title="Main Page">
<ContentPage.ToolbarItems>
<ToolbarItem Text="Logout" Clicked="OnLogoutButtonClicked" Order="Primary" Priority="0"/>
<ToolbarItem Text="Home" Icon="#mipmap/baseline_home_blue_48.png" Clicked="OnHomeIconClicked" Order="Primary" Priority="1"/>
</ContentPage.ToolbarItems>
<ContentPage.Content>
<StackLayout>
<Label Text="Main app content goes here" HorizontalOptions="Center" VerticalOptions="CenterAndExpand" />
</StackLayout>
</ContentPage.Content>
</ContentPage>
Also I've tried setting it from the code behind
var toolbarItemHome = new ToolbarItem
{
Text = "Home",
Icon = "#mipmap/baseline_home_blue_48.png"
};
toolbarItemHome.Clicked += OnHomeIconClicked;
ToolbarItems.Add(toolbarItemHome);
From c# code:
new ToolbarItem () { Icon = "icon.png"}
Or from xaml:
<ToolbarItem Name="iconexample" Icon="icon.png" Priority="0" Order="Primary" Activated="Onclick" />
Have that in mind:
iOS - place the image at /mipmap/icon.png
Android - place the image at /mipmap/drawable/icon.png
I have developed a tabbed page application with Xamarin.Forms. The OS navigation menu is overlapping my application. Can this menu be hidden?
Attach one screenshot:
My XAML are:
RootTabbedPage:
<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MyTimesheet.MainPage"
xmlns:behaviors="clr-namespace:MyTimesheet.Behaviors"
xmlns:ViewModels="clr-namespace:MyTimesheet.ViewModels"
xmlns:pages="clr-namespace:MyTimesheet.Pages"
behaviors:CurrentTabChangedBehavior.AttachBehavior="true"
>
<TabbedPage.BindingContext>
<ViewModels:MainViewModel></ViewModels:MainViewModel>
</TabbedPage.BindingContext>
<pages:ClientiPage Title="Clienti"/>
<pages:CommessePage Title="Commesse"/>
<pages:ConsuntivazioniPage Title="Consuntivazioni"/>
<!--Pages can be added as references or inline-->
</TabbedPage>
My Child page:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:ViewModels="clr-namespace:MyTimesheet.ViewModels"
xmlns:Converters="clr-namespace:MyTimesheet.Converters"
xmlns:Ext="clr-namespace:MyTimesheet.Extensions"
x:Class="MyTimesheet.Pages.ClientiPage">
<ContentPage.BindingContext>
<ViewModels:ClientiViewModel/>
</ContentPage.BindingContext>
<StackLayout >
...
assets\icons\24\24_addsquarebutton.png
...
</ContentPage>
I found an example to develop tabbed page on xamaring forum
I have a problem making a tabbed layout on my master detail page. I have tried to do it like this:
<?xml version="1.0" encoding="utf-8" ?>
<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MasterDetailTest.View"
x:Class="MasterDetailTest.MainPage">
<MasterDetailPage.Master>
<local:MasterPage x:Name="masterPage" />
</MasterDetailPage.Master>
<MasterDetailPage.Detail>
<NavigationPage>
<x:Arguments>
<local:Home />
</x:Arguments>
</NavigationPage>
<TabbedPage>
<TabbedPage.Children>
<ContentPage Title="Home" Icon="home.png"/>
<ContentPage Title="Home" Icon="home.png"/>
<ContentPage Title="Home" Icon="home.png"/>
</TabbedPage.Children>
</TabbedPage>
</MasterDetailPage.Detail>
</MasterDetailPage>
But for some reason it's not working adding tabbed page just on xaml, should i've to try this at the cs?
you can't put TabbedPage inside NavigationPage. The right order is:
- TabbedPage > NavigationPage > page.
In Fact, you shouldn't mix it. Use MasterDetailPage > NavigationPage
OR TabbedPage > NavigationPage BUT NOT MasterDetailPage > TabbedPage.
this would works for you:
MasterDetail:
https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/navigation/master-detail-page/
TabbedPage:
https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/navigation/tabbed-page/
Hi I have just started using xamarin to try and develop a cross platform application but I have hit a problem very early on with my winphone project.
I have a tabbedpage which contains 2 navigationpages. Both these navigationpages have identical content the only thing that differs is the Title of each. The problem comes when swiping between the tabbed pages. When first loaded it renders correctly but once I have gone around the tabbed once I seem to lose a Title and the other 1 jumps to the top of the page which I don't want. The location tabbedpage renders fine.
MainPage.xaml
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:iLarm;assembly=iLarm"
x:Class="iLarm.MainPage">
<NavigationPage Title="Alarm">
<x:Arguments>
<local:AlarmListPage />
</x:Arguments>
</NavigationPage>
<NavigationPage Title="Location" >
<x:Arguments>
<local:LocationListPage />
</x:Arguments>
</NavigationPage>
</TabbedPage>
AlarmListPage.xaml
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="iLarm.AlarmListPage"
Title="iLarm">
</ContentPage>
locationListPage.xaml
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="iLarm.LocationListPage"
Title="iLarm">
</ContentPage>
According to your codes, I wrote a demo. But the title of ContentPage didn't show at all.
From your screenshot I suppose you want to add title to top of the TabbedPage. According to this requirement you just need to set Title of TabbedPage likes below.
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:iLarm;assembly=iLarm"
x:Class="iLarm.MainPage"
Title="iLarm">
<NavigationPage Title="Alarm">
<x:Arguments>
<local:AlarmListPage />
</x:Arguments>
</NavigationPage>
<NavigationPage Title="Location">
<x:Arguments>
<local:LocationListPage />
</x:Arguments>
</NavigationPage>
</TabbedPage>