Enable and control iOS 11 Large Titles in Xamarin.Forms

microsoft xamarin heros c# iOS Android UWP

Apple introduced with iOS 11 a new UI in particular for larger titles: if you open your email, you see at the top a large title. That sit in the Navigation Bar and can be scrolled away when more space is needed. We can enable large titles with a renderer. For this example, I only created a new project and added the following renderer in the iOS project under Renderers folder. You can easily add to all your solution the following renderer in your iOS project: using System; using YourProject.iOS.Renderers;…

Read More

UriBuilder in Xamarin Forms

In Xamarin Forms there is a native function called UriBuilder: it allow you to create a well-formed url. In my implementation, all parameters are in a Dictionary called parameters. Using Linq, I put in builder.Query only the parameters with a value. UriBuilder builder = new UriBuilder(yourUrl); Dictionary<string, string> parameters = new Dictionary<string, string>(); parameters.Add(“reference”, Reference); parameters.Add(“param1”, Param1); builder.Query = string.Join(“&”, parameters.Where(p => !string.IsNullOrWhiteSpace(p.Value)) .Select(p => string.Format(“{0}={1}”, Uri.EscapeDataString(p.Key), Uri.EscapeDataString(p.Value)))); return builder.ToString(); Happy coding!

Read More

Microsoft release new XAML Controls Gallery app to help developers implement Fluent Design

Microsoft is hoping developers will be updating their UWP apps en masse to support their new Fluent Design language, and to help them along Microsoft has published an app in the store that demonstrates all the controls available. “XAML Controls Gallery” demonstrates all of the controls available in Fluent Design System and XAML. It’s the interactive companion to the Fluent Design System web site which can be seen here. According to Microsoft, the new Microsoft Fluent Design System will deliver “intuitive, harmonious, responsive and inclusive cross-device experiences and interactions” for…

Read More

Binding FormattedString for Xamarin Forms

Xamarin Forms doesn’t have a Label with a Bindable FormattedString. For example, if you want a bindable bold word in the middle of a sentence in a Label, it’s very hard to design it with common control. For that, I create my own component for that. LabelRenderer.cs using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.Linq; using System.Runtime.CompilerServices; using Xamarin.Forms; namespace PSC.Controls { public class Label : Xamarin.Forms.Label { protected override void OnBindingContextChanged() { base.OnBindingContextChanged(); UpdateFormattedTextBindingContext(); } protected override void OnPropertyChanged( [CallerMemberName] string propertyName = null) { base.OnPropertyChanged(propertyName); if (propertyName ==…

Read More

Microsoft Launcher review: A beautiful Android experience

After Microsoft gives up on Windows 10 Mobile, Microsoft Launcher is the upgraded version of the Microsoft Garage project Arrow Launcher, and we covered the key changes that came with that upgrade last week. It’s free and can be picked up from the Google Play Store. After some heavy usage over the last few days, we’re breaking down what works, what doesn’t, and where Microsoft should take their launcher from here. As Microsoft Launcher gains more publicity, there have been some rumblings about how it doesn’t look like Windows 10…

Read More

Microsoft gives up on Windows 10 Mobile

The company’s Windows 10 chief has tweeted that developing new features and hardware for the Mobile version of the OS was no longer a "focus". Joe Belfiore added that he had also switched to Android himself. Windows 10 Mobile tried to attract users by letting them run the same "universal apps" on both their PCs and handsets, but the concept failed to catch on. The OS accounted for just 0.03% of the global market – based on smartphone shipments – between April and June, according to research company IDC. The…

Read More

Xamarin Forms Repeater View

microsoft xamarin heros c# iOS Android UWP

A ListView is a kind of repeater but isn’t always what I want. It’s surprising something like this isn’t included in the framework but making your own is fairly simple. namespace PSC.Controls { /// <summary> /// Repeater view. /// </summary> public class RepeaterView : StackLayout { /// <summary> /// The item template property. /// </summary> public static readonly BindableProperty ItemTemplateProperty = BindableProperty.Create( “ItemTemplate”, typeof(DataTemplate), typeof(RepeaterView), null, propertyChanged: (bindable, value, newValue) => Populate(bindable)); /// <summary> /// The items source property. /// </summary> public static readonly BindableProperty ItemsSourceProperty = BindableProperty.Create( “ItemsSource”, typeof(IEnumerable),…

Read More

Hey Cortana, open Alexa: Microsoft and Amazon’s first-of-its-kind collaboration

I talk to Cortana every day — at home, work and on-the-go — to get information about my day, to set reminders so I don’t forget things, and to answer my questions. But I don’t just use one digital assistant. I also frequently talk to Alexa to listen to audio books or to add things to my shopping list. Because people use and interact with all kinds of products, we’re very excited to announce a first-of-its-kind collaboration with Amazon between Cortana and Alexa that will offer more choice, value and…

Read More

Xamarin, Android and starting a service at device boot

In my previous post called Xamarin: how to Start an Application at Device Boot in Android, I explained how you can change your Android Xamarin’s project to launch your app at the device boot. It is a good start but my problem was a bit more complex. I want to create a background service to track the geolocation of a device. I googled a lot to find a solution without a great success. Then I started to implement my code with some tests. Finally, I found a good way and…

Read More

Xamarin: how to Start an Application at Device Bootup in Android

This tutorial will explain to stat an application while the Android device boot-up. For this, we need to  listen to the BOOT_COMPLETED action and react to it. BOOT_COMPLETED is a Broadcast Action that is broadcast once, after the system has finished booting. You can listen to this action by creating a BroadcastReceiver that then starts your launch Activity when it receives an intent with the BOOT_COMPLETED action. Add this permission to your manifest In your Android.Manifest you must add thi permission: <uses-permission android:name=”android.permission.RECEIVE_BOOT_COMPLETED” />   Then open this file and…

Read More

Eat Cookies!

What are Cookies? Cookies are data, stored in small text files, on your computer. When a web server has sent a web page to a browser, the connection is shut down, and the server forgets everything about the user. Cookies were invented to solve the problem "how to remember information about the user": When a user visits a web page, his name can be stored in a cookie. Next time the user visits the page, the cookie "remembers" his name. Cookies are saved in name-value pairs like: username = John…

Read More

C# and multicultural IsDate() and ToDate()

C# does not provide IsDate() function. Sometimes in your developer environment region settings are different from the live environment. In my case, I don’t know what region settings there are in my company servers. For this reason, I created a function to check is a string is a date in a culture and to convert a string to a date. /// /// Determines whether the specified text is date. /// /// The text. /// /// true if the specified text is date; /// otherwise, false. /// public static bool IsDate(this…

Read More

Device name in Xamarin

microsoft xamarin heros c# iOS Android UWP

Using Device Information Plugin for Xamarin and Windows, you have access to same information for a device: GenerateAppId: used to generate a unique Id for your app. Id: this is the device specific Id Device Model: get the model of the device Version: get the version of the Operating System If you want the device name, it’s not in this list. Then for that we can create our functions. IDevice interface First of all we have to create an interface, I call it IDevice. using System; namespace myApp.Interfaces { public…

Read More

Microsoft says iOS and Android support doesn’t mean Windows Phone is dead

In an interview with Business Insider, Microsoft’s Joe Belfiore spoke briefly about Microsoft’s recent announcements made at Build such as the Windows 10 Fall Creators Update but also took the time to comfort those worried about the small presence of Windows phones at the event and Microsoft’s growing focus on iOS and Android devices. “We’re going to continue to support Windows phone,” Belfiore said before adding that, “Windows is a platform that drives the experience on a whole range of devices. We live in a highly diverse world.” With the…

Read More

Render in MVC a link with image and text

Hi guys, I want in MVC to render a text with an image as an ActionLink. For creating a simple anchor tag, we use Html.ActionLink() helper which generates anchor tag for us. If you want to create something a bit more complicated, you must create you own component. For this reason, I created the following code. It allows you to create an anchor with an image and a text. using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Routing; namespace PSC.MVC.Helpers { public static class CustomHtmlHelpers { ///…

Read More

A Simple Speedtest Application

The purpose of this code is the detect how slow is your connection downloading a file from a site. First of all, you have to create a file with a known size: for that you can use fsutil in the prompt (see another post in this blog for info). When yo do put your file in a webserver (or you can use my url), we can create the code to check the connection speed. using System; using System.Collections.Generic; using System.Text; using System.Net; namespace SpeedTest { class Program { static void…

Read More

Xamarin forms, UWP Windows 10 App, TitleBar and Status bar customization

microsoft xamarin heros c# iOS Android UWP

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;…

Read More

WebAssembly is now ready for browsers to use

WebAssembly, a portable code format that could make for a faster web, has moved to minimum viable product (MVP) status, with browser vendors now able to switch WebAssembly on by default. A recent bulletin from Mozilla Senior Staff Engineer Luke Wagner said representatives of the four major browsers agreed that the design and binary format were complete to the extent that no further design work was doable without implementation experience and significant usage. Browsers represented included Google Chrome, Microsoft Edge, Mozilla Firefox, and WebKit, which is Apple’s browser engine for…

Read More

An error occurs with MobileCenter for Xamarin iOS

I added Microsoft Mobile Center to my project after creating the app there. On MobileCenter documentation you can know the Install Identifier for your application (MobileCenter documentation is here). System.Guid installId = MobileCenter.InstallId; This function is working fine if you have Android or iOS 10. With iOS less than 10 an error occurs: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx). and the StackTrace is similar to at System.Guid+GuidResult.SetFailure (System.Guid+ParseFailureKind failure, System.String failureMessageID, System.Object failureMessageFormatArgument, System.String failureArgumentName, System.Exception innerException) [0x00030] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.4.0.123/src/mono/mcs/class/referencesource/mscorlib/system/guid.cs:198 \n at System.Guid+GuidResult.SetFailure (System.Guid+ParseFailureKind failure, System.String failureMessageID)…

Read More

This is iPhone 8

The hardware that allows the iPhone 8‘s rumored facial recognition capability could consist of a "revolutionary" new camera system for its front-facing camera. The report follows related rumors of Apple augmenting or ditching its Touch ID fingerprint scanner in favor of iris or facial recognition technology, fueled by its acquisition of Israeli facial recognition startup RealFace. Samsung’s Galaxy Note 7 — yep, that Galaxy Note 7 — was among the first phones to come equipped with an iris scanner.

Read More

99.6 percent of new smartphones run Android or iOS

The latest smartphone figures from Gartner are out, and they paint an extremely familiar picture. Between them, Android and iOS accounted for 99.6 percent of all smartphone sales in the fourth quarter of 2016. This duopoly has been the norm for a while now (in the second quarter of 2015 this figure was 96.8 percent), but it’s always impressive — and slightly terrifying — to see how Google and Apple continue to wring the last decimal point drops of market share from global smartphone users. Of the 432 million smartphones…

Read More

Happy 15th Birthday .NET!

Today marks the 15th anniversary since .NET debuted to the world. On February 13th, 2002, the first version of .NET was released as part of Visual Studio.NET. It seems just like yesterday when Microsoft was building its “Next Generation Windows Services” and unleashed a new level of productivity with Visual Studio.NET. Since the beginning, the .NET platform has allowed developers to quickly build and deploy robust applications, starting with Windows desktop and web server applications in 2002. You got an entire managed framework for building distributed Windows applications, ASP.NET was…

Read More

Visual Studio 2017 is coming on March 7

Join us at 8:00 AM PST on March 7 for a two-day online event celebrating the launch of our latest version as well as 20 years of Visual Studio. Watch the live stream featuring Julia Liuson, Brian Harry, Miguel de Icaza, and Scott Hanselman as they share the newest innovations in Visual Studio, .NET, Xamarin, Azure, and more. After the keynote, Microsoft engineers will lead interactive technical demo sessions to help you get the most out of Visual Studio 2017 and the rest of our tools and platform. On March…

Read More

Global Resources problem in Xamarin projects

Today I spent a lot of time to understand why my style doesn’t work. <Application xmlns="https://xamarin.com/schemas/2014/forms" xmlns:x="https://schemas.microsoft.com/winfx/2009/xaml" x:Class="myProject.App"> <Application.Resources> <ResourceDictionary> <Style x:Key="WarmGreyLine" TargetType="BoxView"> <Setter Property="HeightRequest" Value="1" /> <Setter Property="HorizontalOptions" Value="Fill" /> <Setter Property="Color" Value="#EEE9E5" /> <Setter Property="Margin" Value="0,10,0,10" /> </Style> </ResourceDictionary> </Application.Resources> </Application> I followed a video about it on Xamarin University. Everything was the same. They say you can copy your style from a ContentPage.Resources and page in the Application.Resources section <ContentPage.Resources> <ResourceDictionary> <Style x:Key="WarmGreyLine" TargetType="BoxView"> <Setter Property="HeightRequest" Value="1" /> <Setter Property="HorizontalOptions" Value="Fill" /> <Setter Property="Color" Value="#EEE9E5" /> <Setter…

Read More