Entradas

Mostrando entradas de 2015

My Favorite Xamarin 4 Feature

Imagen
My Favorite Xamarin 4 Feature

The last week Xamarin introduce his latest new bundle tools version wich include a lot of improvements for the platforms and bran new amazing tools like Xamarin Inspector and Xamarin UI Test Recorder.

Is hard for me only select one Xamarin 4 Feature, so I decided to create an app "Score App" to explore all this new features and select my favorite one, so lets started with the features "less talk, more code".


Xamarin.Forms 2.0

Android Material Design Support I love material design, I love fab (Floating Action Button) and all those beauty colors let me show you this on action:

Looks beauty no, let me tell you that you can implement it in a simple 3 steps
1 Use the FormsAppCompatActivity. 2 Setting up the toolbar and tabs resource. 3 Adding a beauty Android theme you.



ListView New Catching Strategy On of the weaknesses of Xamarin.Forms is the performance of a complex listview cells but with this new feature now you can use the RecycleElement…

View Model Items on ListView Xamarin Forms

Imagen
Hey today I'll show you how to implement the MVVM pattern to update, add and remove data in a listview on Xamarin Forms.

Here the root project files



User.cs : This file contains our user model data in this case Name and Age.UserVM.cs : This file contains all the logic to bind data between view and root model also implements INotifyPropertyChanged pattern.EditUserPage.cs : This is the page to edit user info have two entries and on button to save data.MainPage.cs : This page contains the main listview and a button to add a new user to the listview data we use an ObservableCollection that allow auto-refresh listview data when you modify the datasource, also I implement the listview ContextActions to allow user to modify the listview items with two options edit and delete(iOS swipe left and Android/WP Long click on cell). Now we have the code for each file:

Here the result:





If you want to have access to full example go to this link https://github.com/AlejandroRuiz/XamarinFormsViewModel

Map Center Position Xamarin.Forms

Imagen
Map Center Position Xamarin.Forms Hey all after long time without publish here a new post hope it help you.


As you know in nowadays is common that the apps like Uber get the center position of the map view but the Xamarin.Forms standard map don't have a way to get this, so in this case I'll show a good way to get the map center position using a map renderer
ExtendedMap.cs Code
using System; using Xamarin.Forms.Maps; namespace MapTest.Controls { public class ExtendedMap:Map { public ExtendedMap () { } internal Func<Position> NativeGetMapCenterLocation{ get; set; } public Position GetMapCenterLocation() { if (NativeGetMapCenterLocation != null) { return NativeGetMapCenterLocation (); } else { return new Position(0,0); } } } }
Android ExtendedMapRenderer.cs

using System; using Xamarin.Forms.Maps.Android; using Xamarin.Forms.Platform.Android; using Xamarin.Forms; using Xamarin.Forms.Maps; using MapTest; using MapTest.Droid.Renderers; …

Material Design ListView Header With Xamarin.Android

Imagen