xamarin carousel show some external Page - c#

I have a simple question, How I add in the carouselPage an external page from a diffent folder?
<?xml version="1.0" encoding="utf-8" ?>
<CarouselPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:TutoSuite;assembly=TutoSuite"
x:Class="TutoSuite.navigation.CrouselPage">
<local:MainPage/>
</CarouselPage>
This code works perfectly but when I'm trying to access to an other page who are in a folder and not directly in the root like this. (Client here is a folder where I have all my client's pages)
<?xml version="1.0" encoding="utf-8" ?>
<CarouselPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:TutoSuite;assembly=TutoSuite"
x:Class="TutoSuite.navigation.CrouselPage">
<local:Client.ClientFirstpage/>
</CarouselPage>
I have this error:
Error Position 7:7. Type Client not found in xmlns clr-namespace:TutoSuite;assembly=TutoSuite
can someone help me? thanks in advance

To fix your error, you have to add a reference to the Client namespace, because inner namespaces isn't allowed (local:Client.ClientFirstpage ).
The first step is adding the client namespace reference:
xmlns:client="clr-namespace:TutoSuite.Client"
And then use this reference for the ClientFirstpage
<?xml version="1.0" encoding="utf-8" ?>
<CarouselPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:TutoSuite;assembly=TutoSuite"
xmlns:client="clr-namespace:TutoSuite.Client"
x:Class="TutoSuite.navigation.CrouselPage">
<client.ClientFirstpage/>
</CarouselPage>

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>

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>

Xamarin App won't launch when trying to make popup page

I have a problem. I am using the Nuget package: Rg.Plugins.Popup.Pages with this colorPicker: Spillman.Xamarin.Forms.ColorPicker.
I created this page:
<?xml version="1.0" encoding="utf-8" ?>
<pages:PopupPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:pages="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup"
xmlns:animations="clr-namespace:Rg.Plugins.Popup.Animations;assembly=Rg.Plugins.Popup"
x:Class="Memento.Dialogs.ColorPicker"
xmlns:colorPicker="clr-namespace:Spillman.Xamarin.Forms.ColorPicker;assembly=Spillman.Xamarin.Forms.ColorPicker">
<pages:PopupPage.Animation>
<animations:ScaleAnimation
PositionIn="Center"
PositionOut="Center"
ScaleIn="1.2"
ScaleOut="0.8"
DurationIn="400"
DurationOut="300"
EasingIn="SinOut"
EasingOut="SinIn"
HasBackgroundAnimation="True"/>
</pages:PopupPage.Animation>
<pages:PopupPage.BindingContext>
<colorPicker:ColorPickerViewModel />
</pages:PopupPage.BindingContext>
<ContentView HorizontalOptions="Center" VerticalOptions="Center"
Padding="8" BackgroundColor="White">
<colorPicker:ColorPickerView />
</ContentView>
</pages:PopupPage>
But when I try to define the page like this: ColorPicker_Popup = new ColorPicker(); I get the following error:
Android.Content.Res.Resources+NotFoundException: 'Resource ID #0x7f0700c3'
What am I doing wrong?
Can't you do it like this?
await PopupNavigation.PushAsync(new ColorPicker(), true);

Set content page icon

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.

XamarinForms: Use a Control from a Custom Renderer in XAML

I created my own custom renderer in Xamarin that looks like so:
namespace TestApp
{
public class CustomEntry : Entry
{
public CustomEntry ()
{
}
}
}
How can I include this in my HomePage.xaml file? I tried this:
<?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:TestApp;assembly:TestApp"
x:Class="TestApp.SubPage">
<ContentPage.Content>
<StackLayout>
<local:CustomEntry></local:CustomEntry>
</StackLayout>
</ContentPage.Content>
</ContentPage>
But it didn't work, saying CustomEntry is not a valid control in the "http://xamarin.com/schemas/2014/forms" namespace. Any ideas?
Try changing <x:local="clr-namespace:TestApp;assembly:TestApp"> into <xmlns:local="clr-namespace:TestApp;assembly:TestApp">
And <x:local:CustomEntry> into <local:CustomEntry>
Nevermind, I found the problem. It seems that the xmlns:local declaration I had was wrong. I had this:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:TestApp;assembly:TestApp"
x:Class="TestApp.SubPage">
And it was this:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:TestApp;assembly=TestApp"
x:Class="TestApp.SubPage">
Seems that assembly was assigned with the '=' operator, not the ':' one. The class stayed the same and everything works now.

Categories

Resources