How to implement INotifyPropertyChanged in Xamarin.Forms

As a design methodology, its better to implement MVVM as a subclass and implement it to your ViewModel. Sample Implementation: public class ObservableProperty : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; protected void OnPropertyChanged(string propertyName) { var handler = PropertyChanged; if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); } } I also strongly suggest implementing ICommand as … Read more

How can you restrict/control the navigation routes the user can visit based on login status/role?

Here is an example showing how you can control the visibility or navigation to your pages based on the login status of the user. By default Shell will always displays initially the first element defined in AppShell.xaml, in this case it will be Login.xaml page. In the below example “Page3” will be visible initially because … Read more

Xamarin.Forms ListView: Set the highlight color of a tapped item

In Android simply edit your styles.xml file under Resources\values adding this: <resources> <style name=”MyTheme” parent=”android:style/Theme.Material.Light.DarkActionBar”> <item name=”android:colorPressedHighlight”>@color/ListViewSelected</item> <item name=”android:colorLongPressedHighlight”>@color/ListViewHighlighted</item> <item name=”android:colorFocusedHighlight”>@color/ListViewSelected</item> <item name=”android:colorActivatedHighlight”>@color/ListViewSelected</item> <item name=”android:activatedBackgroundIndicator”>@color/ListViewSelected</item> </style> <color name=”ListViewSelected”>#96BCE3</color> <color name=”ListViewHighlighted”>#E39696</color> </resources>

Xamarin.Forms – Change StatusBar Color

I believe you would be better off writing a little bit of platform-specific code: For Android: On your MainActivity.cs on the Droid project, right after LoadApplication(new App()); of the overriden OnCreate method, add: Window.SetStatusBarColor(Android.Graphics.Color.Argb(255, 0, 0, 0)); Like so: protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); LoadApplication(new … Read more

Hamburger Menu Xamarin Forms (MasterDetailPage)

Creating the master-detail page: Add a content page and change the code as follows : RootPage.xaml <?xml version=”1.0″ encoding=”utf-8″?> <MasterDetailPage xmlns=”http://xamarin.com/schemas/2014/forms” xmlns:x=”http://schemas.microsoft.com/winfx/2009/xaml” xmlns:local=”clr-namespace: your_NameSpace” x:Class=”your_NameSpace.RootPage”> </MasterDetailPage> RootPage.xaml.cs [XamlCompilation(XamlCompilationOptions.Compile)] public partial class RootPage : MasterDetailPage { public RootPage() { InitializeComponent(); } } Creating its Menu Page: Add another content page and change the code as follows … Read more

Check if string is null

The problem is that you’re trying to use a variable that is declared inside a block with a narrower scope (you define crPhoto1Data inside the if block). Another problem is that you’re trying to set it to more than one type. One way solve this is to create the JObject in an if/else statement (or … Read more

How can I publish my Tizen app from Xamarin forms visual studio 2015

Tizen.Net is currently in preview version. Afaik currently you cant deploy Tizen.Net app in real device as current tizen devices are not “dotnet” enabled . Only you can run .net application in Emulator. Ref: https://developer.tizen.org/ko/forums/tizen-.net/device-does-not-have-.net-installed Currently to publish your app in tizen store you need to develop it in Tizen native or web language. To … Read more