Xamarin.Forms code runs on multiple platforms – each of which has its own filesystem. This means that reading and writing files is most easily done using the native file APIs on each platform. Alternatively, embedded resources are a simpler solution to distribute data files with an app. CarouselView CarouselView is available in Xamarin.Forms 4.3. However, it is currently experimental and can only be used by adding the following line of code to your AppDelegate class on iOS, or to your MainActivity class on Android, before calling Forms.Init: Prerequisites Visual Studio…
Category: Universal Windows App
Xamarin Forms: TranslateY (or other properties) for platform
Sometimes you need to change a value for a specific platform and this value is a Double, for example. I spent a couple of minutes to find a working code. <Label> <Label.TranslationY> <OnPlatform x:TypeArguments=”x:Double” Android=”-10″ /> </Label.TranslationY> </Label> Happy coding!
Xamarin forms, UWP Windows 10 App, TitleBar and Status bar customization
Customize the title bar of your Universal App for Windows 10 is quite easy, but you need to write different code for PC and Mobile. The class that allows you to customize the title bar: when running on a PC is called TitleBar when running on a Mobile is called StatusBar Before to call the API you first need to check if it exists (true if you are running on that platform): //PC customization if (ApiInformation.IsTypePresent( “Windows.UI.ViewManagement.ApplicationView”)) { var titleBar = ApplicationView.GetForCurrentView().TitleBar; if (titleBar != null) { titleBar.ButtonBackgroundColor = Colors.DarkBlue;…
Convert Hex Color Code to Brush/SolidColorBrush in XAML App
To set the background color of an object in .NET XAML, you will need to set the Brush object type. To create a Brush object from a hexadecimal color code, use the following. //input ex: #dcdcdc public static Windows.UI.Xaml.Media.SolidColorBrush GetColorFromHex(string hexaColor) { return new Windows.UI.Xaml.Media.SolidColorBrush( Windows.UI.Color.FromArgb( 255, Convert.ToByte(hexaColor.Substring(1, 2), 16), Convert.ToByte(hexaColor.Substring(3, 2), 16), Convert.ToByte(hexaColor.Substring(5, 2), 16) ) ); } Happy coding!
How do I get a Unique Identifier for a Device within Windows 10 Universal?
If you google a bit about this problem, you can’t find a right solution because all people are speaking about Hardware Token. Unfortunately this functionality doesn’t exists for Universal Windows Application. There are at the moment only a way. You have to add the Extension reference “Windows Desktop Extensions for the UWP” or “Windows Mobile Extensions for the UWP“, then you can use the following code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Windows.Security.ExchangeActiveSyncProvisioning; using Windows.System.Profile; namespace PSC.Code { public sealed class DeviceInfo { private static…
UWA: This application can only run in the context of an AppContainer
Run it from VS (with or without debugging). This will actually install unpackaged version of your app, so you will see it in the start screen. Create a package to use locally. You can do this in VS by going to Store → Create App Package → Build a package to use only locally. This will create a bunch of files, including a command-line script that will actually install the app. You probably could use this method to distribute the app, but it would work only on developer-enabled computers. Publish…
Universal Windows app samples
On GitHub Microsoft have published a lot of examples for Universal Apps: the link is https://github.com/Microsoft/Windows-universal-samples This repo contains the samples that demonstrate the API usage patterns for the Universal Windows Platform (UWP) in the Windows Software Development Kit (SDK) for Windows 10. These code samples were created with the Universal Windows templates available in Visual Studio, and are designed to run on desktop, mobile, and future devices that support the Universal Windows Platform. Universal Windows Platform development These samples require Visual Studio 2015 and the Windows Software Development Kit…