Set content page icon - c#

I created an hamburguer menu with master detail page. In the detail page i would like to have a botton navigation bar with shortcuts (like twitter app for android) but icons of eash shortcuts are not being displayed.
I tried using url, file path and ImageSource but none of these displayed the image icon.
<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="KiaiDay.Views.Main.HomePage"
xmlns:pages="clr-namespace:KiaiDay.Views.Main"
xmlns:local="clr-namespace:KiaiDay.MarkupExtensions" NavigationPage.HasNavigationBar="False">
<MasterDetailPage.Master>
...
</MasterDetailPage.Master>
<MasterDetailPage.Detail>
<NavigationPage>
<x:Arguments>
<pages:HomePageDetail />
</x:Arguments>
</NavigationPage>
</MasterDetailPage.Detail>
</MasterDetailPage>
Homepagedetail
<?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="KiaiDay.Views.Main.HomePageDetail"
Title="Pagina Inicial"
xmlns:local="clr-namespace:KiaiDay.MarkupExtensions"
xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"
xmlns:view ="clr-namespace:KiaiDay.Views.PosLogin"
BarBackgroundColor="LightGray" BarTextColor="White"
android:TabbedPage.ToolbarPlacement="Bottom">
<ContentPage Title="Home" Icon="{local:ImageResource KiaiDay.Images.calendarWhite.png}" NavigationPage.TitleIcon="calendarWhite.png"/>
<ContentPage Icon="calendarWhite.png"/>
<ContentPage Icon="https://img.icons8.com/ios/50/000000/calendar-11.png" />
</TabbedPage>
I tried Url of the image, using file path located at android project (Resources/drawable) and ImageSource. None of these were able to display the icon.

So, i solved the problem. It was needed to have the image files in each platform. Android on Resources/drawable and iOS Resources. After that change build action of each image , for Android set AndroidResource and iOS bundleResource.

Related

How to animate the icon in xamarin forms tabbed page

It shows the images but doesn't play the animation.
That's my XML code.
<?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:local="clr-namespace:QRCodeScanner"
xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"
x:Class="QRCodeScanner.MainPage"
android:TabbedPage.ToolbarPlacement="Bottom"
BarBackgroundColor="Black"
SelectedTabColor="Beige"
UnselectedTabColor="DimGray">
<ContentPage IconImageSource="generator.gif"/>
<ContentPage IconImageSource="scanner.gif"/>
</TabbedPage>

Why Toolbar not showing on iOS display using Xamarin

I want to display very simple Toolbar using xamarin on iOS, but I can't see the toolbar on display.
I use this code:
<?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="Test.MainPage">
<ContentPage.ToolbarItems>
<ToolbarItem Text="Example Item"
IconImageSource="https://img.icons8.com/cute-clipart/64/000000/menu.png"
Order="Primary"
Priority="0" />
</ContentPage.ToolbarItems>
</ContentPage>
There are no errors in the code and the display is empty..
What needs to change to see the toolbar ?
Are you putting your page in NavigationPage? By default ContentPage does not have Navigation bar (Toolbar), you must put your page in NavigationPage, after that Navigation bar will show up with its functionality.
have a look at here : Xamarin.Forms Navigation
So I assume you should do something like this
public App ()
{
MainPage = new NavigationPage (new MainPage());
}

How to change size of Icon in Toolbar Xamarin Forms

Please tell me how to change size of icon in Toolbar.Because when I put another icons with the same resolution they are too small
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
Icon="{Binding CurrentIcon}"
x:Class="App1.BicyclePageMain"
xmlns:control="clr-namespace:App1"
BackgroundColor="{AppThemeBinding Light=White, Dark=White}">
</ContentPage>

How do you set the width of tabs in a TabbedPage in Xamarin

I'm using a TabbedPage type in my Xamarin app. I've got the icons and content working perfectly.
The Problem: I can't see to find any way to setting the width of a tab. I want it to be such that the tab widths stretch to match the screen on which they are being rendered
I've tried using a TabbedPageRenderer for Android but none of the properties on their seem to be non-zero so I cannot perform the calculation manually
<?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:IGNORETHIS="clr-namespace:IGNORETHIS;assembly=IGNORETHIS"
xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"
x:Class="IGNORETHIS" <!-- INTENTIONAL -->
android:TabbedPage.ToolbarPlacement="Bottom">
<!-- Account Page -->
<ContentPage Title="Account"
Icon="AccountTabIcon.png">
<StackLayout>
<!-- Blabla some stuff -->
</StackLayout>
</ContentPage>
<!-- Settings Page -->
<ContentPage Title="Settings"
Icon="SettingsTabIcon.png"/>
</TabbedPage>
What I would like is a set of tabs that take up the entire width of the screen. This should be default behavior!

Xamarin - WebView Pull To Refresh

I've searched everywhere on google and it seems like this 'Pull To Refresh' feature is only available for ListViews. There are some posts regarding 'Pull To Refresh' for WebView but they are coded in Java and in Android Studio. Is there any easy way to implement this?
You can use #jamesmontemagno's PullToRefreshLayout and include your WebView inside PullToRefreshLayout element:
<?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="RefreshSample.Views.ScrollViewXamlPage"
xmlns:controls="clr-namespace:Refractored.XamForms.PullToRefresh;assembly=Refractored.XamForms.PullToRefresh"
Title="Xaml Scroll">
<controls:PullToRefreshLayout
IsPullToRefreshEnabled="True"
RefreshCommand="{Binding RefreshCommand}"
IsRefreshing="{Binding IsBusy}"
RefreshColor="Blue">
<WebView>
</WebView>
</controls:PullToRefreshLayout>
</ContentPage>

Categories

Resources