I am using Shell Tabbed Page, and it's working fine. But when I navigate to a new Page using
Navigation.PushAsync(new SecondPage());
Then inside the Second Page Shell Tabbed also showing, so I need to hide this shell from this page.
How to do this?
From Sheel backend cs page I can hide this,I also try with Messaging Center to hide this but its not working.
In your page just add:
Shell.TabBarIsVisible="False"
Here is a sample:
ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Shell.TabBarIsVisible="False"
x:Class="Sample.MySamplePage"
Title="TitleTest">
<StackLayout Spacing="20" Padding="15">
<Label Text="Hello Xamarin"/>
</StackLayout>
</ContentPage>
Related
I'm trying to set tabs in my whole application.
I created a Tabbed page like this :
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:LogiStock.UI.Base.Views"
x:Class="Views.TabbedPage1" >
<!--Pages can be added as references or inline-->
<views:HomePage x:Name="Test" Title="AA"/>
I can navigate on other page from my HomePage but when I do that, my TabbedPage go away.
How can I keep the navigation inside my tab ?
Im using Xamarin 4.4 and Prism 7.2
The only change you need to do is something like:
<NavigationPage Title="AA" IconImageSource="icon.png">
<x:Arguments>
<views:HomePage x:Name="Test" />
</x:Arguments>
</NavigationPage
And then you can push pages to this navigation stack :)
I'm using Xamarin Forms Shell. On one of my <ShellContent> items in my <TabBar>, I just want to open a browser that navigates to a certain URL. I don't have a need to set the ContentTemplate.
It appears that with the <MenuItem> you can set a Command but I don't have the ability to use MenuItem in <TabBar>. Any ideas on how I could achieve this with ShellContent?
<ShellContent
Title="Open Browser"
Icon="browser.png"
Style="{StaticResource DefaultShell}"
???=??? />
You can't use MenuItem in Tabbar. Menuitem can be optionally added to the flyout instead of Tabbar.
I just want to open a browser that navigates to a certain URL.
You still need to set the ContentTemplate with a Page :
<Tab Title="browser" Icon="browser.png">
<ShellContent ContentTemplate="{DataTemplate local:BrowserPage}"/>
</Tab>
Then in that page, navigates to a certain URL:
public BrowserPage()
{
InitializeComponent();
Launcher.OpenAsync("https://www.xamarin.com");
}
Or use a WebView to load the url:
<ContentPage.Content>
<StackLayout>
<WebView HeightRequest="1000" WidthRequest="1000" Source="https://www.xamarin.com"/>
</StackLayout>
</ContentPage.Content>
I uploaded my sample project here and you can check.
I have a working app that displays images. I started a new app and copied the code but this new app does not display images. Puzzled, I have tried many, many things to debug it. I eventually made a plain vanilla new project with only an Image control. As usual, I added the picture to the project using Add Existing Item. I confirmed that the image is there. It does not display the image. I noticed something different in Solution Explorer. Under the Solution, the first project has Dependencies listed under it. This is new. My previous apps have never had that. Now every new project I create has it. I also noticed that the Properties of the image was Build Action of None. I tried changing it to Content but that did not help. At this point, I am baffled and stuck. Did something change in Visual Studio? Here is the image test XAML.
<?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:local="clr-namespace:ImageTest"
x:Class="ImageTest.MainPage">
<StackLayout>
<!-- Place new controls here -->
<Image Source="gr8oz.png" />
<Label Text="Welcome to Xamarin.Forms!"
HorizontalOptions="Center"
VerticalOptions="CenterAndExpand" />
</StackLayout>
</ContentPage>
As I said, I have a working app that has been released. I copied this code into a new app and it does not work. In my investigation, I have found that the Image control does not work for me anymore.
<?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:local="clr-namespace:OFamV2"
Style="{StaticResource MyContentPage}"
x:Class="OFamV2.MainPage"
Title="Main Menus">
<ScrollView>
<StackLayout>
<Button x:Name="TreeButton"
Text="Don and Iola Osborne"
VerticalOptions="Start"
Style="{StaticResource MyButtons}"
Clicked="TreeButton_Clicked" />
<Button x:Name="IndianNamesButton"
Text="Indian Names"
VerticalOptions="Start"
Style="{StaticResource MyButtons}"
Clicked="IndianNamesButton_Clicked" />
<Button x:Name="NextPageButton"
Text="Indian Potpourri"
VerticalOptions="Start"
Style="{StaticResource MyButtons}"
Clicked="NextPageButton_Clicked" />
<Button x:Name="OldPhotos"
Text="Old Photos"
VerticalOptions="Start"
Style="{StaticResource MyButtons}"
Clicked="OldPhotos_Clicked" />
<Button x:Name="ReunionButton"
Text="Family Reunion"
VerticalOptions="Start"
Style="{StaticResource MyButtons}"
Clicked="ReunionButton_Clicked"
/>
<StackLayout Orientation="Horizontal">
<Image
Source="Photos/gr8oz.png"
Style="{StaticResource MyImage}"
Margin="0,30,0,0"
Aspect="AspectFit"
HorizontalOptions="End"
/>
<Image
Source = "Photos/logo.bmp"
Style="{StaticResource MyImage}"
Margin="150,0,0,0"
HeightRequest="200"
WidthRequest="200"
HorizontalOptions="End"/>
</StackLayout>
</StackLayout>
</ScrollView>
</ContentPage>
I have searched and read everything that I can find (and yes, I have read the Microsoft doc about the Image class).
I am also curious why Dependencies suddenly appeared in the Shared Project folder. This is new too. How do I resolve them? See screenshot.
Dependencies under OFamV2.
I uninstalled Visual Studio, deleted the folder, reinstalled Visual Studio Community 2017 Version 15.8.8 and the problem is still there, even with a new project.
For Options, I select Cross Platform/ Mobile App/ Platform: Android and UWP/Code Sharing: .Net Standard.
Set image show you can see here , i think you have used that.
So reload your project,and rebuild it,you can try this.
More info:
Here is a similar disscussion about image show.
Suggest that better not copy code from other project about view,they may result some problems where you do not know.
I am trying to implemenat a TabbedPage with Xamarin Forms. It is very similar to TabbedPage and Content pages are not showing
However I have a quick question as to how to include other xaml files from the MainPage.xam:
Here is my code:
MainPage:
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Assignment"
x:Class="Assignment.MainPage">
<TabbedPage.Children>
<local:Alarm /> "The type 'local:Alarm' was not found. Verify that you are not missing..."
</TabbedPage.Children>
The above error is the only build error.
Alarm.xaml:
<?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="Assignment.Droid.Resources.layout.Alarm">
<ContentPage.Content>
<StackLayout>
<Label Text="Welcome to Xamarin.Forms!"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" />
</StackLayout>
</ContentPage.Content>
</ContentPage>
Here is my project structure:
On the other link, I saw that he put his xaml files in the layout folder.
Is this the correct setup? I think I have missed something simple.
As Greggz mentions: move it to your shared project.
Then you will have to change your namespaces because that is what actually matters. In .NET land, it is customary that your namespace equals the path on your filesystem.
In you Alarm.xaml, change this line: x:Class="Assignment.Droid.Resources.layout.Alarm" to x:Class="Assignment.Alarm".
Then go into your code-behind, the Alarm.xaml.cs file and change the namespace there too. So change namespace Assignment.Droid.Resources.layout to namespace Assignment.
Since the XAML and the code-behind are implemented as a partial class, this needs to be in sync.
I added a third party control in my Xamarin forms project through nuget. I added a xmlns to my xaml for the library, but when I build I get the error: Type flv:FlowListView not found in xmlns clr-namespace:DLToolkit.Forms.Controls.Helpers.FlowListView;assembly=DLToolkit.Forms.Controls.FlowListView
Using the following xaml
<?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:flv="clr-namespace:DLToolkit.Forms.Controls.Helpers.FlowListView;assembly=DLToolkit.Forms.Controls.FlowListView"
x:Class="FScruiser.XF.Pages.Page1">
<ContentPage.Content>
<flv:FlowListView>
<flv:FlowListView.FlowColumnTemplate>
<DataTemplate>
<ViewCell>
<Label Text="text"/>
</ViewCell>
</DataTemplate>
</flv:FlowListView.FlowColumnTemplate>
</flv:FlowListView>
</ContentPage.Content>
</ContentPage>
Try this:
clr-namespace:DLToolkit.Forms.Controls
instead of
clr-namespace:DLToolkit.Forms.Controls.Helpers.FlowListView
So, the full namespace definition is this:
xmlns:flv="clr-namespace:DLToolkit.Forms.Controls;assembly=DLToolkit.Forms.Controls.FlowListView"
Edit: You can also see it in action here on GitHub, in one of the samples.