-
Sharing Resource Dictionaries in your Xamarin.Forms App
The Xamarin.Forms Application base class has a Resources property that you can use to share a resource dictionary across all pages of your app. If your app was created before Xamarin.Forms 1.4 you'll need to make sure you update and make your main App class inherit from the new Application class.
If you like to do everything in code rather than XAML then you can create a ResourceDictionary in the constructor of you App class:
public class App : Application
{
public App()
{
Resources = new ResourceDictionary();
Resources.Add("ForegroundThemeColor",
new Color( …
-
Xamarin Forms at NDC London 2014
If you're interested in finding out more about Xamarin Forms you may find the following interesting:
Free eBook: Creating Mobile Apps with Xamarin.Forms by Charles Petzold (Preview edition)
Video: Creating your first Xamarin.Forms App (Xamarin Evolve 2014)
Video: Xamarin.Forms is Even Cooler Than You Think (Xamarin Evolve 2014)
Video: XAML for Xamarin.Forms (Xamarin Evolve 2014)
Video: Extending Xamarin.Forms with Custom Controls (Xamarin Evolve 2014)
-
Carousel Page in Xamarin Forms XAML
The CarouselPage page is similar to a tabbed page, but you swipe between pages and there are no navigation pages. Windows Phone users will be most used to this type of UI, so you may choose to only use it there, but it will work on all platforms. Here is the XAML:
<?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:NogginXamarinFormSample;assembly=NogginXamarinFormSample"
x:Class="NogginXamarinFormSample.MyCarouselPage">
< …
-
Tabbed Page in Xamarin Forms XAML
The TabbedPage page is a bit like a navigation page in that it is a collection of other pages. However instead of a navigation bar you are shown a collection of tabs. Each tab has a title and may have an icon. Create a new content page using File > Add new, and then change the XAML to this (making sure your x:Class and xmlns:local are correct for your project) and also change the base class in the code behind to TabbedPage:
<!--?xml version="1.0" encoding="UTF-8"?-->
<TabbedPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/ …
-
Navigation Page in Xamarin Forms XAML
A NavigationPage makes it very easy to create a browser like navigation stack of pages with a back button. It is a container for your pages so the XAML to for your ContentPage doesn't change, but when the app starts and you first create the page you put it inside a NavigationPage like this:
public static Page GetMainPage()
{
return new NavigationPage(MyPage());
}
Now we have a navigation page, you'll need a new page to navigate too, so create a new page and then on your first page add a button like this:
<Button Text="Press me" Clicked="OnClicked"/>
You'll then need to add an event …
-
Content Page in Xamarin Forms XAML
The simplest of the Xamarin Page controls is the ContentPage. There is a template for this in Xamarin Studio so you can use the Add > New File... option. Here is the XAML so you can see a ContentPage along with a placeholder BoxView control so there is some content to see.
<!--?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="NogginXamarinFormSample.MyPage"
title="A Content Page">
<boxview color="Silver" />
</contentpage>
To show …