Add a Tizen Project to Xamarin.Forms Applications
Jay Cho
This blog provides helpful information for new Tizen .NET application developers to get started.
In many cases, you'll want to add a Tizen project to existing Xamarin.Forms cross-platform applications or implement Tizen renderers for Xamarin.Forms third-party libraries, which already include other platforms. In these cases, you can simply add a Tizen project to the existing solution.
Add a Tizen Project to Visual Studio
The following example shows a cross-platform app named SimpleText, which shows a line of text in the center. The text varies depending on the platform:
- On an Android Emulator, the text appears as “Welcome to Xamarin.Forms.Android!”
- On an iOS Simulator, the text appears as “Welcome to Xamarin.Forms.iOS!”
Now, let's add a Tizen project to run on the Tizen platform in Visual Studio:
- Go to File > Add > New Project.
- Select the Tizen cross-platform template Tizen XAML App (Xamarin.Forms)
- Give your project the name
SimpleText.Tizen
.
On the Tizen project wizard:
- Select Common as the profile. Other available profiles are Mobile, TV, and Wearable.
- Choose Select Project in Solution.
- Select
SimpleText
as the reference. - Add code
LoadApplication(new SimpleText.App())
to theSimpleText.Tizen/SimpleText.Tizen.cs
file.
The following video shows a quick runthrough of the process:
Run on the Tizen platform
Now you are ready to build and run the application on Tizen platform.
Here is the text for Tizen on Label.Text
on the main page of the application:
<?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:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="SimpleText.MainPage">
<StackLayout>
<!-- Place new controls here -->
<Label Text="{OnPlatform Android='Welcome to Xamarin.Forms.Android!',
iOS='Welcome to Xamarin.Forms.iOS!',
Tizen='Welcome to Xamarin.Forms.Tizen!'}}"
HorizontalOptions="Center"
VerticalOptions="CenterAndExpand" />
</StackLayout>
</ContentPage>
And you can check out how it looks on the Wearable target emulator:
It's pretty easy to add a Tizen project to your existing solution. Try it today!