<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Kernel32.net</title>
    <description>Oddbjørn U. Bakke
</description>
    <link>https://kernel32.net/</link>
    <atom:link href="https://kernel32.net/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Wed, 26 Sep 2018 10:30:36 +0000</pubDate>
    <lastBuildDate>Wed, 26 Sep 2018 10:30:36 +0000</lastBuildDate>
    <generator>Jekyll v3.7.4</generator>
    
      <item>
        <title>Faster context switching with Chrome profiles</title>
        <description>&lt;h1 id=&quot;faster-context-switching-with-chrome-profiles&quot;&gt;Faster context switching with Chrome profiles&lt;/h1&gt;
&lt;p&gt;I have used Chrome profiles for a while. This is really good to seperate and isolate things like credentials between different instances of chrome. And when I mention this for other people, there are a lot that does not know about this gem of a feature.&lt;/p&gt;

&lt;p&gt;I currently use 3 profiles, personal, work, and customer.&lt;/p&gt;

&lt;p&gt;By using profiles I can now use the same portal for different rols, ex. the Azure Profile. I don’t need to log out and in between sessions. Just open the browser from the right shortcut.&lt;/p&gt;

&lt;p&gt;This is all nice, however. One issue happend every time when I open links, ex. from Slack. Those whould be sent to my Default browser (was Edge).&lt;/p&gt;

&lt;p&gt;My taskbar currently looks like this:&lt;br /&gt;
&lt;img src=&quot;/images/2018-06-01-taskbar.png&quot; alt=&quot;my browsers in the taskbar&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The shortcuts goes to:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Edge (default)&lt;/li&gt;
  &lt;li&gt;Personal Profile&lt;/li&gt;
  &lt;li&gt;Customer Profile&lt;/li&gt;
  &lt;li&gt;Work Profile&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;better-browser-switching&quot;&gt;Better browser switching&lt;/h2&gt;

&lt;p&gt;By using this nice tool called &lt;a href=&quot;https://browserchooser2.com/&quot;&gt;BrowserChooser&lt;/a&gt;, I can now choose my browser with the right profile directly when open link.&lt;br /&gt;
&lt;img src=&quot;/images/2018-06-01-switcher.png&quot; alt=&quot;Welcomescreen of browserchooser2&quot; /&gt;&lt;/p&gt;

&lt;p&gt;That is all nice, but it also supports automaticly choosing a profile based on patterns in the link, ex. customer domain etc.&lt;/p&gt;

&lt;p&gt;Another nice feature, is that I can automaticly choose the right browser based on patterns in the link, ex. customers domain etc.&lt;/p&gt;

&lt;p&gt;Now we are talking. :)&lt;/p&gt;

&lt;h2 id=&quot;setup-browser-switching&quot;&gt;Setup browser switching&lt;/h2&gt;

&lt;p&gt;First download the applications, this is a portable exe, so I manually put it in &lt;em&gt;‘C:\Program Files\Browser Chooser’&lt;/em&gt;.
Then you will need to setup it as your default browser. Open the application, go to the setup (right top link), click on &lt;em&gt;‘Windows Default’&lt;/em&gt;, then &lt;em&gt;‘Add to Default programs’&lt;/em&gt; and &lt;em&gt;‘Show Defaults Dialog*‘&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2018-06-01-default.png&quot; alt=&quot;Add as default&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now you should be able to make BrowserChooser as your default browser.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2018-06-01-default_windows.png&quot; alt=&quot;Windows default dialog&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Since BrowserChooser cannot use the same icons as in the taskbar directly from Chromes folders, you must copy them over to a place where it can find them.&lt;/p&gt;

&lt;p&gt;To copy the Profile icons from Chrome, go to ‘%userprofile%\AppData\Local\Google\Chrome\User Data\Profile #’, where ‘#’ is profile number. Copy the ‘Google Profile.ico’ as the ‘&lt;profilename&gt;.ico' to the 'BrowserChooser Folder'.&lt;/profilename&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2018-06-01-copyicon.png&quot; alt=&quot;Copy the correct icons&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now go to the Shortcuts settings, and clone up chrome to the number of profiles.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2018-06-01-shortcuts.png&quot; alt=&quot;Shortcuts dialog&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Edit them manually like this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2018-06-01-shortcut_settings.png&quot; alt=&quot;How to set up a shortcut to a profile&quot; /&gt;&lt;/p&gt;

&lt;p&gt;To add URL patterns go to ‘Auto URLs’. With wildcards this can be very powerfull.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2018-06-01-autourl.png&quot; alt=&quot;Auto choose browser based on url patterns&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Now when you click on a configured link, it should open chrome with the right profile automaticly.&lt;/p&gt;

&lt;h2 id=&quot;autourl-rules&quot;&gt;AutoURL Rules&lt;/h2&gt;

&lt;p&gt;BrowserChooser is a VB.Net application, and uses the &lt;a href=&quot;https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/operators/like-operator&quot;&gt;string LIKE operator&lt;/a&gt;, on version 2.0.4.38373.
It also removes “https://”, “http://” and “www.” from the pattern.&lt;/p&gt;

&lt;p&gt;Special characters in pattern:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;?	Any single character&lt;/li&gt;
  &lt;li&gt;*	Zero or more characters&lt;/li&gt;
  &lt;li&gt;#	Any single digit (0–9)&lt;/li&gt;
  &lt;li&gt;[charlist]	Any single character in charlist&lt;/li&gt;
  &lt;li&gt;[!charlist]	Any single character not in charlist&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This means:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;There is no need to use http, https, or www in the pattern.&lt;/li&gt;
  &lt;li&gt;”*.” will require start of something else than “www.”.&lt;/li&gt;
  &lt;li&gt;Pattern “*.test.com*” will hit “http://test.test.com/” but not “http://www.test.com/”&lt;/li&gt;
  &lt;li&gt;Pattern “*test.com*” will hit both.&lt;/li&gt;
  &lt;li&gt;Pattern “*test.com*/#user/*” will not hit  “http://test.com/#user/function”&lt;/li&gt;
  &lt;li&gt;Pattern “*test.com*/[#]user/*” will hit “http://test.com/#user/function”&lt;/li&gt;
  &lt;li&gt;Pattern “*” will hit everything, and must therefor be the last pattern. You can use this for selecting a default browser.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example rules:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;span&gt;”*test.com/*”&lt;/span&gt;&lt;/li&gt;
  &lt;li&gt;&lt;span&gt;“company.sharepoint.com/*”&lt;/span&gt;&lt;/li&gt;
  &lt;li&gt;&lt;span&gt;“company.visualstudio.com/*”&lt;/span&gt;&lt;/li&gt;
  &lt;li&gt;&lt;span&gt;“confluence.company.com/*”&lt;/span&gt;&lt;/li&gt;
  &lt;li&gt;&lt;span&gt;“localhost:19080/Explorer/”&lt;/span&gt;&lt;/li&gt;
  &lt;li&gt;&lt;span&gt;“jira.company.com/*”&lt;/span&gt;&lt;/li&gt;
  &lt;li&gt;&lt;span&gt;“portal.azure.com/[#]@company.com/*”&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So…&lt;/p&gt;

&lt;p&gt;Time Saved…Is Time Earned…&lt;br /&gt;
Work smarter, not harder…&lt;br /&gt;
…&lt;br /&gt;
You know… all that. :)&lt;/p&gt;

&lt;div id=&quot;disqus_thread&quot;&gt;&lt;/div&gt;
&lt;script&gt;
    /**
     *  RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
     *  LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables
     */
    /*
    var disqus_config = function () {
        this.page.url = PAGE_URL;  // Replace PAGE_URL with your page's canonical URL variable
        this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
    };
    */
    (function() {  // DON'T EDIT BELOW THIS LINE
        var d = document, s = d.createElement('script');
        
        s.src = '//kernel32.disqus.com/embed.js';
        
        s.setAttribute('data-timestamp', +new Date());
        (d.head || d.body).appendChild(s);
    })();
&lt;/script&gt;

&lt;noscript&gt;Please enable JavaScript to view the &lt;a href=&quot;https://disqus.com/?ref_noscript&quot; rel=&quot;nofollow&quot;&gt;comments powered by Disqus.&lt;/a&gt;&lt;/noscript&gt;
</description>
        <pubDate>Fri, 01 Jun 2018 00:00:00 +0000</pubDate>
        <link>https://kernel32.net/guide/google%20chrome/chrome%20profiles/2018/06/01/browserchooser.html</link>
        <guid isPermaLink="true">https://kernel32.net/guide/google%20chrome/chrome%20profiles/2018/06/01/browserchooser.html</guid>
        
        
        <category>Guide</category>
        
        <category>Google Chrome</category>
        
        <category>Chrome Profiles</category>
        
      </item>
    
      <item>
        <title>What I hope for the future of Xamarin.Forms</title>
        <description>&lt;h1 id=&quot;its-time-to-redesign-xamrin-forms&quot;&gt;It’s time to redesign Xamrin Forms&lt;/h1&gt;
&lt;p&gt;First of all, Xamarin.iOS and Xamarin.Android is a piece of art. It’s mature, robust, and a really impressive piece of work.
XF is currently in version 2.3 but is still young and buggy, however it has a great potential.
I have now worked a while with XF, and I see that it probably should have been made a little different.&lt;/p&gt;

&lt;p&gt;Todays biggest problem with XF is the same as most cross platform frameworks: It tries to abstract to much.&lt;/p&gt;

&lt;p&gt;The design gives you little control over navigation and layouting, and it feels a lot similar to WebForms.
This is really nice for those who just want a simple app fast, and does not care about the platform it’s running on.
However, this is not the usecase for most developers. We just want a framework that does things easier for us, but we still have all the control we need.
And a possiblity to use just the parts of the framework we need.&lt;/p&gt;

&lt;p&gt;If you develop with XF today, you will get a lot for free from the framework.
It’s easy to start with, and easy to prototype with.
The amount of work needed to get something done, will be something like this:&lt;br /&gt;
&lt;img src=&quot;/images/2016-11-27-forms_graph.png&quot; alt=&quot;image of a eddystone-url notification&quot; width=&quot;200&quot; /&gt;&lt;/p&gt;

&lt;p&gt;However if you reach the point where it stops being a benefit, it would probably also be to late to switch to Xamarin Native.
This is where XF could be different from all the other frameworks, and give a huge benefit, if designed different.&lt;/p&gt;

&lt;h2 id=&quot;open-sourceode&quot;&gt;Open Sourceode&lt;/h2&gt;

&lt;p&gt;XF is now OpenSource, this is awesome.
However, we can easily see that this was not the planned at the design time.
There are so many internal logic and utils, that would be nice to work with, that is neither documented or set to public.&lt;/p&gt;

&lt;p&gt;Xamarin do take Pull Requests, and there are several commits by the community.
However they do reject commits that breaks backward compatibility.
This is quite scary, as this is often a bad smell that the project is to tightly coupled together to resolve.
This could have been fixed with proper version management, or proper modulization.&lt;/p&gt;

&lt;p&gt;However as of today, Xamarin tend to break something at every new version themselves, so having this strict backward compatibility policy does not make much sense.&lt;/p&gt;

&lt;h2 id=&quot;platforma--platformb&quot;&gt;PlatformA != PlatformB&lt;/h2&gt;

&lt;p&gt;The architecture of iOS, Android, Windows and Mac is just too different to make one common framework. A button is not just a button, and a label is not just a label.
A cross platform framework should not try to hide this, since this is an impossible task.
It should however embrace it, and make it easier to work around the differences.&lt;/p&gt;

&lt;p&gt;Today there are a lot of thing we as developer cannot change to easy, as there is a lot of magic going on inside XF.
The problem I often see, is hardcoded values that is not easy to replace.&lt;/p&gt;

&lt;p&gt;Some examples of this is:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Buttons on iOS that is hardcoded as RoundedRect.&lt;br /&gt;
&lt;em&gt;Can be fixed with &lt;code&gt;SetNativeControl&lt;/code&gt;, however this will skip some other internal setup code.&lt;/em&gt;&lt;/li&gt;
  &lt;li&gt;Buttons on Android.&lt;br /&gt;
&lt;em&gt;When adding a border, it uses a custom drawable as background on the button&lt;/em&gt;&lt;/li&gt;
  &lt;li&gt;Page transitions on Android &lt;a href=&quot;/2016/06/25/xamarin-forms-transitions.html&quot;&gt;see previous post&lt;/a&gt;.&lt;br /&gt;
&lt;em&gt;AppCompat can override the transition, but the page will be removed before you can do anything on back navigation.&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;Modern/Material has hardcoded animations when pushing a page to the stack&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;my-suggestion&quot;&gt;My suggestion&lt;/h2&gt;

&lt;p&gt;When I look at XF, I would have liked to see this more like a service working side-by-side with the native code,
with the possible to replace as much of the native code you want to.&lt;/p&gt;

&lt;p&gt;Then the developer team to work with, can find the exact sweetspot between abstraction and native, rather than replacing the whole application to the framework.&lt;/p&gt;

&lt;p&gt;To do this I would suggest splitting XF into submodules.&lt;/p&gt;

&lt;p&gt;The design should look something like this:&lt;br /&gt;
&lt;img src=&quot;/images/2016-11-27-xamarin-design.png&quot; alt=&quot;image of a eddystone-url notification&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;XF.Core:&lt;/strong&gt;&lt;br /&gt;
The absolute minimum we need to make tooling, and the components working together.
This should be as fast as possible.&lt;/p&gt;

&lt;p&gt;This module should be able to be a full stand alone module, with no other dependencies.
Therefor it must also include the renderer engine to convert XF Components into native ones.&lt;/p&gt;

&lt;p&gt;Also the layout system should probably be here, at least part of it.
However, it should be redesigned to give more control to the developer, and then could be abstracted out in an other component.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;XF.Components:&lt;/strong&gt;&lt;br /&gt;
A module to include common components like Buttons, Labels, etc.&lt;/p&gt;

&lt;p&gt;If most of your code is custom, you would probably want to make your own components in stead.
Also you might want to do some funky stuff, like using SkiaSharp based components, this would not be needed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;XF.Features:&lt;/strong&gt;&lt;br /&gt;
Used together with &lt;em&gt;XF.Components&lt;/em&gt; to provide extra features like:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Effect&lt;/li&gt;
  &lt;li&gt;Animations&lt;/li&gt;
  &lt;li&gt;Gestures&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;XF.Navigation:&lt;/strong&gt;&lt;br /&gt;
A module for the navigation between pages.&lt;/p&gt;

&lt;p&gt;This could also include common MVVM framework features like MessagingCenter, IoC etc.
The reason to not have this in the core, it that your favourite MVVM framework, would probably have their own implementation of this. In that case you skip this component all together.&lt;/p&gt;

&lt;h2 id=&quot;pcl-vs-shared-libraries&quot;&gt;PCL vs Shared libraries&lt;/h2&gt;
&lt;p&gt;I love PCLs, and I hope for NetStandards support in Xamarin.
However, I don’t think PCLs would be the correct place for UI code, as a components like a button should be limited to the platform.
Since PCLs don’t know anything about the platform, XF should prefer having the shared UI in shared projects, and the background platform independent code like services in PCL.&lt;/p&gt;

&lt;p&gt;If I work with a component, I would prefer to get a 100% working feature, instead of something that is hacked together to look similar as another platform.
If the developer however should want this code, this should be another components package.&lt;/p&gt;

&lt;h2 id=&quot;but-i-do-love-xamarinforms&quot;&gt;But I do love Xamarin.Forms&lt;/h2&gt;
&lt;p&gt;XF is easy to start with, and can do so much for you.
The layout system is awesome, however it would need to give more control to the developer.&lt;/p&gt;

&lt;p&gt;The community is really helpful, and if you don’t get answers there, you could always ask the iOS or Android community.
And it is not hard to port native code to Xamarin Native or XF.&lt;/p&gt;

&lt;p&gt;XF is really helpful while prototyping, and work great especially on iOS.
However, the Android part of XF needs some polishing.
This is not to much of a problem after XF got Custom Renderers and possiblity to add native code directly, and it’s easy to do partial Xamarin.Android or Xamarin.iOS develop where XF is not fast or powerfull enough.&lt;/p&gt;

&lt;p&gt;I like XF, and with todays design, I would still use it in most cases, unless I know that the project would need a lot of custom graphics and animations.
XF is a impressive piece of work, however with todays it is not for everyone, but with a redesign, I think it would benefit more developers.&lt;/p&gt;

&lt;p&gt;The Xamarin platform, is just a piece of art, and I love so much about it. :)&lt;/p&gt;

&lt;p&gt;What they have achieved with the tools, and how easy it is to use TestCloud, Azure and other providers.
It’s so nice and neat. You don’t need Xamarin to use it, but it sure gives that little extra.&lt;/p&gt;

&lt;div id=&quot;disqus_thread&quot;&gt;&lt;/div&gt;
&lt;script&gt;
    /**
     *  RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
     *  LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables
     */
    /*
    var disqus_config = function () {
        this.page.url = PAGE_URL;  // Replace PAGE_URL with your page's canonical URL variable
        this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
    };
    */
    (function() {  // DON'T EDIT BELOW THIS LINE
        var d = document, s = d.createElement('script');
        
        s.src = '//kernel32.disqus.com/embed.js';
        
        s.setAttribute('data-timestamp', +new Date());
        (d.head || d.body).appendChild(s);
    })();
&lt;/script&gt;

&lt;noscript&gt;Please enable JavaScript to view the &lt;a href=&quot;https://disqus.com/?ref_noscript&quot; rel=&quot;nofollow&quot;&gt;comments powered by Disqus.&lt;/a&gt;&lt;/noscript&gt;
</description>
        <pubDate>Sun, 27 Nov 2016 00:00:00 +0000</pubDate>
        <link>https://kernel32.net/xamarin/xamarin.forms/ios/android/mobile/ui/2016/11/27/xamarin-forms-future.html</link>
        <guid isPermaLink="true">https://kernel32.net/xamarin/xamarin.forms/ios/android/mobile/ui/2016/11/27/xamarin-forms-future.html</guid>
        
        
        <category>Xamarin</category>
        
        <category>Xamarin.Forms</category>
        
        <category>iOS</category>
        
        <category>Android</category>
        
        <category>Mobile</category>
        
        <category>UI</category>
        
      </item>
    
      <item>
        <title>Bluetooth Low Energy Beacons</title>
        <description>&lt;p&gt;A Bluetooth Low Energy Beacon is a simple one-way technology that works like a lighthouse.
All it does is sending out a bluetooth message with its id, and signal strength (Tx Power).
This in an interval typical inside the 100ms - 1000ms range.
The faster is often better, but uses more power from the beacon.&lt;/p&gt;

&lt;p&gt;It comes in different forms, some that uses batteries (coin, AA etc.), and some that drains its power from a USB or wall socket.
Also computers and mobile devices can work as beacons, but then with limitations (adjustment of signal strength, etc.).&lt;/p&gt;

&lt;p&gt;There are several standards, some of the most common are:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://developer.apple.com/ibeacon/&quot;&gt;iBeacon&lt;/a&gt;: App. Apple specification. Native iOS.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/AltBeacon/spec&quot;&gt;AltBeacon&lt;/a&gt;: App. Open specification. Similar to iBeacon &lt;em&gt;(and compatible)&lt;/em&gt;, but less strict.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/google/eddystone/blob/master/protocol-specification.md&quot;&gt;Eddystone&lt;/a&gt;: Native Android, comes with four different frames:
    &lt;ul&gt;
      &lt;li&gt;UID: App, frame.&lt;/li&gt;
      &lt;li&gt;URL: Physical web &lt;em&gt;(can be used without dedicated app on Android)&lt;/em&gt;.&lt;/li&gt;
      &lt;li&gt;TLM: Extension to give more information like, temperature, battery status, etc.&lt;/li&gt;
      &lt;li&gt;EID: Security frame.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example of a Eddystone-URL on Android:&lt;br /&gt;
&lt;img src=&quot;/images/2016-08-24-eddystone-url.png&quot; alt=&quot;image of a eddystone-url notification&quot; width=&quot;200&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Regions:&lt;/strong&gt;&lt;br /&gt;
A region is a set of beacons, where you will be inside of that region, if you see one or more of the beacons. Naming is here essential, if you choose a region id that someone else has, your beacons will trigger theirs app, or theirs will trigger yours. There are however more than enough combinations, so just pick a random one and stick with it.&lt;/p&gt;

&lt;p&gt;iBeacon / AltBeacon:&lt;br /&gt;
Created of a UUID, Major and Major: &lt;code class=&quot;highlighter-rouge&quot;&gt;[FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF]&lt;/code&gt;, &lt;code class=&quot;highlighter-rouge&quot;&gt;[65535]&lt;/code&gt;, &lt;code class=&quot;highlighter-rouge&quot;&gt;[65535]&lt;/code&gt;&lt;br /&gt;
On iBeacon you can scan for the UUID or the UUID + Major.&lt;/p&gt;

&lt;p&gt;Eddystone-UID:&lt;br /&gt;
Created of a Namespace and Instance: &lt;code class=&quot;highlighter-rouge&quot;&gt;[FFFFFFFFFFFFFFFFFFFF]&lt;/code&gt;, &lt;code class=&quot;highlighter-rouge&quot;&gt;[FFFFFFFFFFFF]&lt;/code&gt;&lt;br /&gt;
On Eddystone you can scan for all beacons or divided by namespace.&lt;/p&gt;

&lt;h2 id=&quot;modes&quot;&gt;Modes&lt;/h2&gt;
&lt;p&gt;Beacons comes in two modes: Ranging and monitoring.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ranging&lt;/strong&gt;&lt;br /&gt;
Ranging is the one you will use when the application is open and on the screen.
You can scan in whatever interval you want, as you have all the applications resources to use.
However, be nice. It will consume power.&lt;/p&gt;

&lt;p&gt;To calculate the distance, the phone will tell the signal strength it’s receiving on, and this combined with the information of the transmitting strength (tx power), you can calculate the estimated distance (typical done inside of a SDK/library).&lt;/p&gt;

&lt;p&gt;However, since every phone is different, it is hard to get this correct. Other factors like echo of the radio waves, walls, or people, might also give a wrong distance.&lt;/p&gt;

&lt;p&gt;This will therefor make things like trilateration very hard. So you should probably not try to make your own positioning library.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Monitoring&lt;/strong&gt;&lt;br /&gt;
Monitoring is used as a background service to start a job on the event of entering or exiting a region.
This can then be used to push a notification, or similar to the user when going inside, or out of some area.&lt;/p&gt;

&lt;p&gt;There are two ways of scanning for regions.&lt;br /&gt;
One is using the native format of the device, and have the HW scan for you. This typical triggers the event after a couple of seconds on entering, and half a minute plus some seconds on exit (30s to be sure it’s not just some missing messages).&lt;/p&gt;

&lt;p&gt;The other way of scanning is having a job that starts every X minutes. However, this will not be as responsive, and if you have a low message interval on the beacons (ex. 1s), you might miss them. In the case of a low interval, you might actually not trigger the event at all.&lt;/p&gt;

&lt;p&gt;There are also restrictions of how many regions a App can listen after (20 on iOS).
However, if this is a problem, you probably doing something very wrong.&lt;/p&gt;

&lt;h2 id=&quot;use-cases&quot;&gt;Use cases&lt;/h2&gt;
&lt;p&gt;There are several places where you can use beacons to give something extra to the user, or to collect some extra data.
However, in most cases, you cannot depend on it to work at all.&lt;br /&gt;
This is because:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;The user must have your app installed (except Eddystone-URL).&lt;/li&gt;
  &lt;li&gt;The user must have a modern phone (ex. Android 4.3+).&lt;/li&gt;
  &lt;li&gt;The user must have bluetooth switched on. And given enough access to the app.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Som typical places to use beacons could be:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Large buildings: Shopping malls, Hospitals, Stadiums.&lt;/li&gt;
  &lt;li&gt;Smaller buildings: Resturants, home automation.&lt;/li&gt;
  &lt;li&gt;Public transportation.&lt;/li&gt;
  &lt;li&gt;IoT.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some possible usecases:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Many is interested in using beacons or WiFi for indoor navigation.&lt;/li&gt;
  &lt;li&gt;Advertisement &lt;em&gt;(however be carefull, to much spam, and people will turn bluetooth off)&lt;/em&gt;.&lt;/li&gt;
  &lt;li&gt;Proximity based alerts. &lt;em&gt;Example: “you are standing on the wrong bus stop”&lt;/em&gt;.&lt;/li&gt;
  &lt;li&gt;Proximity based searches in searchengines.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, using other sources like WiFi, GPS, sound, vibration, etc., might be good enough.
Just look at applications like MazeMap, Citymapper, Tripadvisor, Foursquare, etc.&lt;/p&gt;

&lt;h2 id=&quot;security&quot;&gt;Security&lt;/h2&gt;
&lt;p&gt;Since beacons are a one-way technology, there is often not much to security on them, other than when connecting to change the configuring.&lt;/p&gt;

&lt;p&gt;Anyone can buy a beacon and use the same ID as you, so what is often done in this case is to change the IDs in intervals on several minutes.
However if the beacons are placed at fixed point, a sensor at another fixed point can very fast know what the new IDs is.&lt;br /&gt;
From there you can do stuff like:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Spoof the IDs, and guide person the wrong way.&lt;/li&gt;
  &lt;li&gt;Spoof the IDs, and spam the user with notifications from the official app.&lt;/li&gt;
  &lt;li&gt;Use the original beacons in a competitive app.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;getting-started&quot;&gt;Getting started&lt;/h2&gt;
&lt;p&gt;To get started you can start with using a mobile device as a beacon, or buy a developer kit &lt;em&gt;(Kontakt.io, Estimote, RadiusNetworks, GemTot, etc.)&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;I have both USB and battery beacons that I play with. USB are often better, as you can change the message interval, beacon standard, transmitting power, etc.
To develop I like to use the AltBeacon library for Android, as it’s open and based on the standards.&lt;/p&gt;

&lt;p&gt;If you want to go a little deeper, you can get something like the nRF52, and start writing some beacon firmware. The nRF52 uses the same chips as many of the better once, like Estimote and Kontakt.io.
I also have a Adafruit BLE sniffer that works with wireshark.&lt;/p&gt;

&lt;div id=&quot;disqus_thread&quot;&gt;&lt;/div&gt;
&lt;script&gt;
    /**
     *  RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
     *  LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables
     */
    /*
    var disqus_config = function () {
        this.page.url = PAGE_URL;  // Replace PAGE_URL with your page's canonical URL variable
        this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
    };
    */
    (function() {  // DON'T EDIT BELOW THIS LINE
        var d = document, s = d.createElement('script');
        
        s.src = '//kernel32.disqus.com/embed.js';
        
        s.setAttribute('data-timestamp', +new Date());
        (d.head || d.body).appendChild(s);
    })();
&lt;/script&gt;

&lt;noscript&gt;Please enable JavaScript to view the &lt;a href=&quot;https://disqus.com/?ref_noscript&quot; rel=&quot;nofollow&quot;&gt;comments powered by Disqus.&lt;/a&gt;&lt;/noscript&gt;
</description>
        <pubDate>Wed, 24 Aug 2016 00:00:00 +0000</pubDate>
        <link>https://kernel32.net/beacon/bluetooth/location/2016/08/24/beacons.html</link>
        <guid isPermaLink="true">https://kernel32.net/beacon/bluetooth/location/2016/08/24/beacons.html</guid>
        
        
        <category>beacon</category>
        
        <category>bluetooth</category>
        
        <category>location</category>
        
      </item>
    
      <item>
        <title>Running Jekyll in Docker for Windows</title>
        <description>&lt;p&gt;I recently formated my computer to install Windows 10 and lost my jekyll installation.
Instead of installing jekyll again, I wanted to test how it is to run it from a docker image.
As I am new to docker, I wanted to see if I could do everything from the UI, before learning the commands.&lt;/p&gt;

&lt;h2 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;/h2&gt;
&lt;ol&gt;
  &lt;li&gt;Have installed Windows 10 Anniversary Update&lt;/li&gt;
  &lt;li&gt;Have installed &lt;a href=&quot;https://docs.docker.com/docker-for-windows/&quot;&gt;Docker for Windows&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;Have installed &lt;a href=&quot;https://github.com/docker/kitematic/releases&quot;&gt;Kitematic&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The first thing you need to do, is to download the jekyll image: &lt;a href=&quot;https://hub.docker.com/r/jekyll/jekyll/&quot;&gt;jekyll/jekyll&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can do this directly from kitematic.
I assigned a fixed port (settings/ports), and pointed my volume (settings/volumes) to my local github repository.&lt;/p&gt;

&lt;p&gt;After this it should be able to run, but I got some permission errors:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2016-08-21-permission.png&quot; alt=&quot;Error: Permission denied @ dir_s_mkdir - /srv/jekyll/_site&quot; /&gt;&lt;/p&gt;

&lt;p&gt;To fix this, you can open the docker settings, go to “shared drives”, then check C and enter your credentials.&lt;/p&gt;

&lt;p&gt;After this, my “hello world” jekyll service was running in a linux VM (MobyLinuxVM) on Windows 10.&lt;/p&gt;

&lt;div id=&quot;disqus_thread&quot;&gt;&lt;/div&gt;
&lt;script&gt;
    /**
     *  RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
     *  LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables
     */
    /*
    var disqus_config = function () {
        this.page.url = PAGE_URL;  // Replace PAGE_URL with your page's canonical URL variable
        this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
    };
    */
    (function() {  // DON'T EDIT BELOW THIS LINE
        var d = document, s = d.createElement('script');
        
        s.src = '//kernel32.disqus.com/embed.js';
        
        s.setAttribute('data-timestamp', +new Date());
        (d.head || d.body).appendChild(s);
    })();
&lt;/script&gt;

&lt;noscript&gt;Please enable JavaScript to view the &lt;a href=&quot;https://disqus.com/?ref_noscript&quot; rel=&quot;nofollow&quot;&gt;comments powered by Disqus.&lt;/a&gt;&lt;/noscript&gt;
</description>
        <pubDate>Sun, 21 Aug 2016 00:00:00 +0000</pubDate>
        <link>https://kernel32.net/2016/08/21/jekyll-in-docker-for-windows-using-kitematic.html</link>
        <guid isPermaLink="true">https://kernel32.net/2016/08/21/jekyll-in-docker-for-windows-using-kitematic.html</guid>
        
        <category>docker</category>
        
        <category>kitematic</category>
        
        <category>jekyll</category>
        
        <category>github-pages</category>
        
        <category>windows</category>
        
        
      </item>
    
      <item>
        <title>Using Module Initializers</title>
        <description>&lt;p&gt;Code at &lt;a href=&quot;https://github.com/oddbear/ModuleInitTest&quot;&gt;github&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Module Initializers is something most .Net developers has never heard about.
It’s a part of .Net, but not supported in the C# language (as C# does not support global functions).
However, since .Net itself supports it, you should be aware that it exists.
A Module Initializer is a piece of code that runs before any other code in the .Net application, and can be triggered in some situations even with just reading metadata:&lt;/p&gt;

&lt;p&gt;Either by:
&lt;code&gt;typeof(SomeProject.SomeClass).FullName&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Or:&lt;/p&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;assembly&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Assembly&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Load&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;SomeProject&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//Use ReflectionOnlyLoad&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;assembly&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;SomeProject.SomeClass&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;attributes&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetMethod&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;SomeMethod&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetCustomAttributes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;By using fody with ModuleInit &lt;a href=&quot;https://github.com/Fody/ModuleInit&quot;&gt;link&lt;/a&gt;, you can actually create Module Initializers in a C# project.
What it does is copy the compiled IL of a special method, and creating a Module Initializer out of it.&lt;/p&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Initialize&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ad&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;AppDomain&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;CurrentDomain&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;try&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ps&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ad&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;PermissionSet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;Console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Works Do bad stuff here!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;MethodAccessException&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;Console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Exeption Happend! :O&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If you don’t want this code to run for some reason, ex if want to setup a sandbox for some protection with partial trusted code.
It could be wise to use &lt;code&gt;Assembly.ReflectionOnlyLoad()&lt;/code&gt; instead of &lt;code&gt;Assembly.Load()&lt;/code&gt;.&lt;/p&gt;

&lt;div id=&quot;disqus_thread&quot;&gt;&lt;/div&gt;
&lt;script&gt;
    /**
     *  RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
     *  LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables
     */
    /*
    var disqus_config = function () {
        this.page.url = PAGE_URL;  // Replace PAGE_URL with your page's canonical URL variable
        this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
    };
    */
    (function() {  // DON'T EDIT BELOW THIS LINE
        var d = document, s = d.createElement('script');
        
        s.src = '//kernel32.disqus.com/embed.js';
        
        s.setAttribute('data-timestamp', +new Date());
        (d.head || d.body).appendChild(s);
    })();
&lt;/script&gt;

&lt;noscript&gt;Please enable JavaScript to view the &lt;a href=&quot;https://disqus.com/?ref_noscript&quot; rel=&quot;nofollow&quot;&gt;comments powered by Disqus.&lt;/a&gt;&lt;/noscript&gt;
</description>
        <pubDate>Thu, 30 Jun 2016 00:00:00 +0000</pubDate>
        <link>https://kernel32.net/2016/06/30/dotnet-module-initializers.html</link>
        <guid isPermaLink="true">https://kernel32.net/2016/06/30/dotnet-module-initializers.html</guid>
        
        <category>dotnet</category>
        
        <category>security</category>
        
        <category>fody</category>
        
        
      </item>
    
      <item>
        <title>Custom buttons in Xamarin Forms</title>
        <description>&lt;p&gt;I also Wrote part of this as a &lt;a href=&quot;http://forums.xamarin.com/discussion/68240/buttons-and-effects-on-ios&quot;&gt;post&lt;/a&gt; on the forum.&lt;/p&gt;

&lt;h3 id=&quot;creating-a-custom-button&quot;&gt;Creating a custom button&lt;/h3&gt;

&lt;p&gt;There are several ways of achieving this (often with TapGestureRecognizer), but after Xamarin.Forms 2.3 they introduced effects. I wanted to try this out to make a custom Xamarin.Forms button, and I think it worked out quite well.&lt;/p&gt;

&lt;p&gt;I created a normal state, and a clicked state as a svg file:&lt;/p&gt;

&lt;div class=&quot;language-xml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;svg&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;viewBox=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;0 0 100 100&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;width=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;100px&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;height=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;100px&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;xmlns=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://www.w3.org/2000/svg&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- http://www.w3schools.com/svg/svg_feoffset.asp --&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;defs&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;filter&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;filter1&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;x=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-10%&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;y=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-10%&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;width=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;140%&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;height=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;140%&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;nt&quot;&gt;&amp;lt;feOffset&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;result=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;offOut&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;in=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;SourceGraphic&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;dx=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;2&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;dy=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;2&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;nt&quot;&gt;&amp;lt;feColorMatrix&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;result=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;matrixOut&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;in=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;offOut&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;matrix&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;values=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;0.2 0.0 0.0 0.0 0.0 0.0 0.2 0.0 0.0 0.0 0.0 0.0 0.2 0.0 0.0 0.0 0.0 0.0 1.0 0.0&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;nt&quot;&gt;&amp;lt;feGaussianBlur&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;result=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;blurOut&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;in=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;matrixOut&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;stdDeviation=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;3&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;nt&quot;&gt;&amp;lt;feBlend&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;in=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;SourceGraphic&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;in2=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;blurOut&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;mode=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;normal&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/filter&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;/defs&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;path&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;d=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;M50 15 L90 85 L10 85 Z&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;stroke-linejoin=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;round&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;stroke-width=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;6&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;stroke=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;black&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;fill=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;yellow&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;filter=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;url(#filter1)&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;circle&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;cx=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;50&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;cy=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;72&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;r=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;5&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;path&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;d=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;M45 42 L55 42 L50 60 Z&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;stroke-linejoin=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;round&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;stroke-width=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;5&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;stroke=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;black&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;fill=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;black&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;c&quot;&gt;&amp;lt;!-- &amp;lt;g transform=&quot;scale(0.9) translate(5, 5)&quot;&amp;gt; #Copy paths over in here for pressed effect(can also adjust shadow before rendering)# &amp;lt;/g&amp;gt; --&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/svg&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Result:&lt;/p&gt;
&lt;svg viewBox=&quot;0 0 100 100&quot; width=&quot;100px&quot; height=&quot;100px&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;
    &lt;!-- http://www.w3schools.com/svg/svg_feoffset.asp --&gt;
    &lt;defs&gt;
        &lt;filter id=&quot;filter1&quot; x=&quot;-10%&quot; y=&quot;-10%&quot; width=&quot;140%&quot; height=&quot;140%&quot;&gt;
          &lt;feOffset result=&quot;offOut&quot; in=&quot;SourceGraphic&quot; dx=&quot;2&quot; dy=&quot;2&quot; /&gt;
          &lt;feColorMatrix result=&quot;matrixOut&quot; in=&quot;offOut&quot; type=&quot;matrix&quot; values=&quot;0.2 0.0 0.0 0.0 0.0
                  0.0 0.2 0.0 0.0 0.0
                  0.0 0.0 0.2 0.0 0.0
                  0.0 0.0 0.0 1.0 0.0&quot; /&gt;
          &lt;feGaussianBlur result=&quot;blurOut&quot; in=&quot;matrixOut&quot; stdDeviation=&quot;3&quot; /&gt;
          &lt;feBlend in=&quot;SourceGraphic&quot; in2=&quot;blurOut&quot; mode=&quot;normal&quot; /&gt;
        &lt;/filter&gt;
    &lt;/defs&gt;
    
    &lt;path d=&quot;M50 15 L90 85 L10 85 Z&quot; stroke-linejoin=&quot;round&quot; stroke-width=&quot;6&quot; stroke=&quot;black&quot; fill=&quot;yellow&quot; filter=&quot;url(#filter1)&quot; /&gt;
    &lt;circle cx=&quot;50&quot; cy=&quot;72&quot; r=&quot;5&quot; /&gt;
    &lt;path d=&quot;M45 42 L55 42 L50 60 Z&quot; stroke-linejoin=&quot;round&quot; stroke-width=&quot;5&quot; stroke=&quot;black&quot; fill=&quot;black&quot; /&gt;
&lt;/svg&gt;
&lt;svg viewBox=&quot;0 0 100 100&quot; width=&quot;100px&quot; height=&quot;100px&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;
    &lt;!-- http://www.w3schools.com/svg/svg_feoffset.asp --&gt;
    &lt;defs&gt;
        &lt;filter id=&quot;filter1&quot; x=&quot;-10%&quot; y=&quot;-10%&quot; width=&quot;140%&quot; height=&quot;140%&quot;&gt;
          &lt;feOffset result=&quot;offOut&quot; in=&quot;SourceGraphic&quot; dx=&quot;2&quot; dy=&quot;2&quot; /&gt;
          &lt;feColorMatrix result=&quot;matrixOut&quot; in=&quot;offOut&quot; type=&quot;matrix&quot; values=&quot;0.2 0.0 0.0 0.0 0.0
                  0.0 0.2 0.0 0.0 0.0
                  0.0 0.0 0.2 0.0 0.0
                  0.0 0.0 0.0 1.0 0.0&quot; /&gt;
          &lt;feGaussianBlur result=&quot;blurOut&quot; in=&quot;matrixOut&quot; stdDeviation=&quot;3&quot; /&gt;
          &lt;feBlend in=&quot;SourceGraphic&quot; in2=&quot;blurOut&quot; mode=&quot;normal&quot; /&gt;
        &lt;/filter&gt;
    &lt;/defs&gt;
    &lt;g transform=&quot;scale(0.9) translate(5, 5)&quot;&gt;
        &lt;path d=&quot;M50 15 L90 85 L10 85 Z&quot; stroke-linejoin=&quot;round&quot; stroke-width=&quot;6&quot; stroke=&quot;black&quot; fill=&quot;yellow&quot; filter=&quot;url(#filter1)&quot; /&gt;
        &lt;circle cx=&quot;50&quot; cy=&quot;72&quot; r=&quot;5&quot; /&gt;
        &lt;path d=&quot;M45 42 L55 42 L50 60 Z&quot; stroke-linejoin=&quot;round&quot; stroke-width=&quot;5&quot; stroke=&quot;black&quot; fill=&quot;black&quot; /&gt;
    &lt;/g&gt;
&lt;/svg&gt;

&lt;p&gt;To get the SVG’s in the project, I use &lt;a href=&quot;https://github.com/shakiba/svgexport&quot;&gt;SvgExport&lt;/a&gt;, and a &lt;a href=&quot;https://gist.github.com/oddbear/9d03aaa1a5a780a198764f8ee4953149&quot;&gt;python script&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To get started, I needed to create two classes in the Xamarin Forms PCL:&lt;/p&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;CustomButton&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Button&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ButtonEffect&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;RoutingEffect&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;ButtonEffect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;base&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Effects.ButtonEffect&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And the button i Xaml like this:&lt;/p&gt;

&lt;div class=&quot;language-xml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;local:CustomButton&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;HeightRequest=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;80&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;WidthRequest=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;80&quot;&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;HorizontalOptions=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Center&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;local:CustomButton.Effects&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;local:ButtonEffect&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/local:CustomButton.Effects&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/local:CustomButton&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The reason for having a custom button type, is a issue in iOS (more on that later).&lt;/p&gt;

&lt;h3 id=&quot;android&quot;&gt;Android&lt;/h3&gt;
&lt;p&gt;Create a effect in the Android project like this:&lt;/p&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;[assembly: ResolutionGroupName(&quot;Effects&quot;)]&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;[assembly: ExportEffect(typeof(ButtonEffect), &quot;ButtonEffect&quot;)]&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;namespace&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;ProjectName.Droid&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ButtonEffect&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;PlatformEffect&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;OnAttached&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;button&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Android&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Support&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;V7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Widget&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AppCompatButton&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Control&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;SetBackgroundResource&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Resource&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Layout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;buttonEffect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

        &lt;span class=&quot;k&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;OnDetached&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;c1&quot;&gt;// Use this method if you wish to reset the control to original state&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And the xml like this:&lt;/p&gt;

&lt;div class=&quot;language-xml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;selector&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;xmlns:android=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://schemas.android.com/apk/res/android&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;item&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;android:state_selected=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;true&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;bitmap&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;android:gravity=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;fill&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;android:src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;@drawable/buttonPressed&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;/item&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;item&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;android:state_pressed=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;true&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;bitmap&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;android:gravity=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;fill&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;android:src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;@drawable/buttonPressed&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;/item&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;item&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;bitmap&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;android:gravity=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;fill&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;android:src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;@drawable/buttonNormal&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;&amp;lt;/item&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/selector&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And that should work. :)&lt;/p&gt;

&lt;h3 id=&quot;ios&quot;&gt;iOS&lt;/h3&gt;

&lt;p&gt;To get the button to work in Xamarin iOS, add this effect:&lt;/p&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;[assembly: Xamarin.Forms.ResolutionGroupName(&quot;Effects&quot;)]&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;[assembly: Xamarin.Forms.ExportEffect(typeof(ButtonEffect), &quot;ButtonEffect&quot;)]&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;namespace&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;ProjectName.iOS&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ButtonEffect&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Xamarin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Forms&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Platform&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;iOS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;PlatformEffect&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;OnAttached&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;button&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UIButton&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Control&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;c1&quot;&gt;//var element = (Xamarin.Forms.Button)Element;&lt;/span&gt;
            &lt;span class=&quot;c1&quot;&gt;//var container = (Xamarin.Forms.Platform.iOS.ButtonRenderer)Container;&lt;/span&gt;

            &lt;span class=&quot;n&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;SetBackgroundImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UIImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;FromFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;buttonNormal.png&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;UIControlState&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Normal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;SetBackgroundImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UIImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;FromFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;buttonPressed.png&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;UIControlState&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Highlighted&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

        &lt;span class=&quot;k&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;OnDetached&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;c1&quot;&gt;// Use this method if you wish to reset the control to original state&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The problem then is that you get a highlight effect you cannot remove.&lt;/p&gt;

&lt;p&gt;What you then get:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2016-06-26-button_normal.png&quot; alt=&quot;button with default renderer&quot; /&gt;&lt;/p&gt;

&lt;p&gt;What you might want:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/2016-06-26-button_custom.png&quot; alt=&quot;button with custom renderer&quot; /&gt;&lt;/p&gt;

&lt;p&gt;By poking around in the Xamarin Forms sourcecode, I found out that they use code like this:
&lt;code&gt;SetNativeControl(new UIButton(UIButtonType.RoundedRect));&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The problem here is that the UIButton is constructed of type RoundedRect, and this is not changeable after the construction.&lt;/p&gt;

&lt;p&gt;It was then easy to figure out that I could make some code like this to fix it:&lt;/p&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;[assembly: ExportRenderer(typeof(CustomButton), typeof(CustomButtonRenderer))]&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;namespace&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;ProjectName.iOS&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;CustomButtonRenderer&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ButtonRenderer&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;OnElementChanged&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ElementChangedEventArgs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Button&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;nf&quot;&gt;SetNativeControl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;UIButton&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UIButtonType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Custom&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;Control&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;TouchUpInside&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sender&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ev&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Element&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;?.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Command&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;?.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Execute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Element&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;TextColor&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Color&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Default&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//#00000000&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;Element&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;TextColor&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Control&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;TitleColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;UIControlState&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Normal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ToColor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//#FFFFFFFF&lt;/span&gt;

            &lt;span class=&quot;k&quot;&gt;base&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;OnElementChanged&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;What you need to do, is to run the &lt;code&gt;SetNativeControl&lt;/code&gt; method to create the button before calling the base.
However, XF will then skip some code, so you will need to copy your click event or command to the button.&lt;/p&gt;

&lt;p&gt;There is also a Xamarin fix for default colors that you can run manually.&lt;/p&gt;

&lt;p&gt;After this, just call the base method.&lt;/p&gt;

&lt;div id=&quot;disqus_thread&quot;&gt;&lt;/div&gt;
&lt;script&gt;
    /**
     *  RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
     *  LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables
     */
    /*
    var disqus_config = function () {
        this.page.url = PAGE_URL;  // Replace PAGE_URL with your page's canonical URL variable
        this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
    };
    */
    (function() {  // DON'T EDIT BELOW THIS LINE
        var d = document, s = d.createElement('script');
        
        s.src = '//kernel32.disqus.com/embed.js';
        
        s.setAttribute('data-timestamp', +new Date());
        (d.head || d.body).appendChild(s);
    })();
&lt;/script&gt;

&lt;noscript&gt;Please enable JavaScript to view the &lt;a href=&quot;https://disqus.com/?ref_noscript&quot; rel=&quot;nofollow&quot;&gt;comments powered by Disqus.&lt;/a&gt;&lt;/noscript&gt;
</description>
        <pubDate>Sun, 26 Jun 2016 00:00:00 +0000</pubDate>
        <link>https://kernel32.net/2016/06/26/xamarin-custom-button.html</link>
        <guid isPermaLink="true">https://kernel32.net/2016/06/26/xamarin-custom-button.html</guid>
        
        <category>Xamarin</category>
        
        <category>Xamarin.Forms</category>
        
        <category>iOS</category>
        
        <category>Android</category>
        
        <category>Mobile</category>
        
        <category>UI</category>
        
        <category>SVG</category>
        
        
      </item>
    
      <item>
        <title>Xamarin custom page transitions</title>
        <description>&lt;p&gt;Code on github can be found &lt;a href=&quot;https://github.com/oddbear/XamarinNavigationTransitions&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;transitions&quot;&gt;Transitions&lt;/h3&gt;
&lt;p&gt;You might have seen some applications with nice and smooth animations/transitions between pages, 
and in Xamarin.Forms you might want to change the page transitions to be something similar.
However this is poorly documented, and hard to get started with.&lt;/p&gt;

&lt;p&gt;There are several examples on the samples &lt;a href=&quot;https://developer.xamarin.com/samples-all/&quot;&gt;site&lt;/a&gt;, but those are not for Xamarin.Forms.&lt;/p&gt;

&lt;p&gt;Xamarin Forms 2.3 is sadly not made to support custom transitions very well, 
and if this is important in your application, 
you will probably want to go for pure Xamarin Android and iOS instead.
The good part is that by poking around in the sourcecode, it seems like this is something that they will improve in the future.&lt;/p&gt;

&lt;h3 id=&quot;navigation-on-ios&quot;&gt;Navigation on iOS:&lt;/h3&gt;
&lt;p&gt;iOS is the easiest to make custom page transitions.&lt;/p&gt;

&lt;p&gt;A good resource will be to look at this &lt;a href=&quot;https://forums.xamarin.com/discussion/18818/custom-page-transitions-with-xamarin-forms&quot;&gt;forum post&lt;/a&gt;, and with the &lt;a href=&quot;https://gist.github.com/alexlau811/e12a8c126e6e082a5017&quot;&gt;example&lt;/a&gt; it was easily able to get this working nice and smooth.&lt;/p&gt;

&lt;h3 id=&quot;navigation-on-android-appcompat&quot;&gt;Navigation on Android AppCompat:&lt;/h3&gt;
&lt;p&gt;Navigation on AppCompat is a little harder, but by poking around in the &lt;a href=&quot;https://github.com/xamarin/Xamarin.Forms&quot;&gt;sourcecode&lt;/a&gt;, 
I found that an override of the &lt;a href=&quot;http://stackoverflow.com/questions/35593073/xamarin-appcompat-navigationpagerenderer-transitions&quot;&gt;SetupPageTransition&lt;/a&gt; would make you able to add custom transitions between the pages.
There is however a little bug in this approach when navigation back in the navigationstack. The fragment actually is removed from the stack before the animation is finished.&lt;/p&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;[assembly: ExportRenderer(typeof(NavigationPage), typeof(AnimationNavigationRenderer))]&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;namespace&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;ProjectName.Droid&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;AnimationNavigationRenderer&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Xamarin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Forms&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Platform&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Android&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AppCompat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NavigationPageRenderer&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;SetupPageTransition&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Android&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Support&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;V4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;App&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FragmentTransaction&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;transaction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;bool&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;isPush&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;isPush&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;transaction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;SetCustomAnimations&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Resource&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Animation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;abc_slide_in_top&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Resource&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Animation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;abc_slide_out_top&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;transaction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;SetCustomAnimations&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Resource&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Animation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;abc_slide_in_top&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Resource&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Animation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;abc_slide_out_top&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;navigation-on-android-5&quot;&gt;Navigation on Android 5+:&lt;/h3&gt;

&lt;div class=&quot;warning&quot;&gt;
	&lt;svg viewBox=&quot;0 0 100 100&quot; width=&quot;50px&quot; height=&quot;50px&quot; style=&quot;float:left;padding-right:5px;&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;
		&lt;defs&gt;
			&lt;filter id=&quot;filter1&quot; x=&quot;-10%&quot; y=&quot;-10%&quot; width=&quot;140%&quot; height=&quot;140%&quot;&gt;
			  &lt;feOffset result=&quot;offOut&quot; in=&quot;SourceGraphic&quot; dx=&quot;2&quot; dy=&quot;2&quot; /&gt;
			  &lt;feColorMatrix result=&quot;matrixOut&quot; in=&quot;offOut&quot; type=&quot;matrix&quot; values=&quot;0.2 0.0 0.0 0.0 0.0
					  0.0 0.2 0.0 0.0 0.0
					  0.0 0.0 0.2 0.0 0.0
					  0.0 0.0 0.0 1.0 0.0&quot; /&gt;
			  &lt;feGaussianBlur result=&quot;blurOut&quot; in=&quot;matrixOut&quot; stdDeviation=&quot;3&quot; /&gt;
			  &lt;feBlend in=&quot;SourceGraphic&quot; in2=&quot;blurOut&quot; mode=&quot;normal&quot; /&gt;
			&lt;/filter&gt;
		&lt;/defs&gt;
		
		&lt;path d=&quot;M50 15 L90 85 L10 85 Z&quot; stroke-linejoin=&quot;round&quot; stroke-width=&quot;6&quot; stroke=&quot;black&quot; fill=&quot;yellow&quot; filter=&quot;url(#filter1)&quot; /&gt;
		&lt;circle cx=&quot;50&quot; cy=&quot;72&quot; r=&quot;5&quot; /&gt;
		&lt;path d=&quot;M45 42 L55 42 L50 60 Z&quot; stroke-linejoin=&quot;round&quot; stroke-width=&quot;5&quot; stroke=&quot;black&quot; fill=&quot;black&quot; /&gt;
	&lt;/svg&gt;
	This post is for Xamarin 2.3, and the code will need small changes to work on later versions.
	
		&lt;br /&gt;&lt;i&gt;(It uses reflection on code already changed in latest branch)&lt;/i&gt;
	
	&lt;div style=&quot;clear:both;&quot;&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;I tried several ways of achieving this, however the only solution I found without too many bugs in it, was to get Xamarin.Forms to skip some code, and do this manually.&lt;/p&gt;

&lt;p&gt;It’s not that hard to add custom animations:&lt;/p&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;AddView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Android&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Views&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;View&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;child&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;base&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;AddView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;child&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;child&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Visibility&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ViewStates&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Visible&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;animation&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;AnimationUtils&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;LoadAnimation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Resource&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Animator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;transition_from_left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;animation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AnimationEnd&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sender&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;child&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Animation&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;child&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Animation&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;animation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;//Alternative logic (code):&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;////child.Alpha = 0;&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;////child.ScaleX = child.ScaleY = 0.8f;&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;//child.TranslationX = Resources.DisplayMetrics.WidthPixels;&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;//ViewPropertyAnimator animatior = child.Animate().TranslationX(0).SetDuration(200); //.ScaleX(1).ScaleY(1).Alpha(1)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Xamarin has hardcoded the default animation, so there is not much to do there. We therefor need to always send in &lt;code&gt;animated = false&lt;/code&gt; when calling &lt;code&gt;base.OnPushAsync&lt;/code&gt;, when using custom animations.
The hard part is that Xamarin hides the previus page before the animation is finished.
By setting the private field &lt;code&gt;_current = null&lt;/code&gt;, Xamarin will however skip this part.
To do this we need to use some reflection magic (this code might change in later versions):&lt;/p&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Page&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;SwitchView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Page&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;currentView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;field&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;BaseType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetField&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;_current&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;BindingFlags&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NonPublic&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;BindingFlags&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Instance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pastView&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Page&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;field&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;field&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;SetValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;currentView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pastView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;But then we will need to manually hide the previous page:&lt;/p&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;renderer&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Platform&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetRenderer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pastView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pastView&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;renderer&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;renderer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ViewGroup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Parent&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;SendDisappearing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pastView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;To call the SendDisappearing, we will need to use reflection.
In current branch on Github of Xamarin.Forms, they have however changed this.
In the future we probably can call this without reflection.&lt;/p&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;SendDisappearing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Page&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pageType&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;typeof&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Xamarin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Forms&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Page&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sendDisappearingMethod&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pageType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetMethod&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;SendDisappearing&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;BindingFlags&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NonPublic&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;BindingFlags&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Instance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sendDisappearingMethod&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Invoke&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Whole code will then look like this:&lt;/p&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;[assembly: ExportRenderer(typeof(NavigationPage), typeof(CustomNavigationAnimationRenderer))]&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;namespace&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;ProjectName.Droid&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;CustomNavigationAnimationRenderer&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Xamarin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Forms&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Platform&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Android&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NavigationRenderer&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;c1&quot;&gt;//Warning: Will break in a later release of Xamarin.Forms:&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;SendDisappearing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Page&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pageType&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;typeof&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Xamarin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Forms&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Page&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sendDisappearingMethod&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pageType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetMethod&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;SendDisappearing&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;BindingFlags&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NonPublic&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;BindingFlags&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Instance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;sendDisappearingMethod&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Invoke&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

        &lt;span class=&quot;c1&quot;&gt;//Warning: Uses reflection, might break in a later release:&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Page&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;SwitchView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Page&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;currentView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;field&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;BaseType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetField&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;_current&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;BindingFlags&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NonPublic&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;BindingFlags&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Instance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pastView&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Page&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;field&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;field&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;SetValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;currentView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pastView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

        &lt;span class=&quot;k&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Task&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;bool&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;OnPushAsync&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Page&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;view&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;bool&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;animated&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pastView&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;SwitchView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//Removes the previous view from parent (NavigationRenderer).&lt;/span&gt;

            &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;base&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;OnPushAsync&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;view&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//Execute code.&lt;/span&gt;

            &lt;span class=&quot;c1&quot;&gt;//Manually run parents code that was skipped:&lt;/span&gt;
            &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;renderer&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Platform&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetRenderer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pastView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pastView&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;renderer&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;null&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;renderer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ViewGroup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Parent&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;nf&quot;&gt;SendDisappearing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pastView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

            &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

        &lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;AddView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Android&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Views&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;View&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;child&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;base&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;AddView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;child&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;child&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Visibility&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ViewStates&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Visible&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

            &lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;animation&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;AnimationUtils&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;LoadAnimation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Resource&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Animator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;transition_from_left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;animation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AnimationEnd&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sender&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;child&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Animation&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;child&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Animation&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;animation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

            &lt;span class=&quot;c1&quot;&gt;//Alternative logic (code):&lt;/span&gt;
            &lt;span class=&quot;c1&quot;&gt;////child.Alpha = 0;&lt;/span&gt;
            &lt;span class=&quot;c1&quot;&gt;////child.ScaleX = child.ScaleY = 0.8f;&lt;/span&gt;
            &lt;span class=&quot;c1&quot;&gt;//child.TranslationX = Resources.DisplayMetrics.WidthPixels;&lt;/span&gt;
            &lt;span class=&quot;c1&quot;&gt;//ViewPropertyAnimator animatior = child.Animate().TranslationX(0).SetDuration(200); //.ScaleX(1).ScaleY(1).Alpha(1)&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;There are two ways I found to make these transitions.&lt;/p&gt;

&lt;p&gt;Either by using xml resources:&lt;/p&gt;

&lt;div class=&quot;language-xml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;set&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;xmlns:android=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://schemas.android.com/apk/res/android&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;android:fillAfter=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;true&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;translate&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;android:duration=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;250&quot;&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;android:fromXDelta=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;-100%&quot;&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;android:toXDelta=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;0&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/set&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And the code:&lt;/p&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;animation&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;AnimationUtils&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;LoadAnimation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Resource&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Animator&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;transition_from_left&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;animation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AnimationEnd&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sender&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;child&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Animation&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;child&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Animation&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;animation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Or hard coded (like XF does):&lt;/p&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;child&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;TranslationX&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Resources&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DisplayMetrics&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;WidthPixels&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;ViewPropertyAnimator&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;animatior&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;child&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Animate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;TranslationX&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;SetDuration&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Good luck. :)&lt;/p&gt;

&lt;div id=&quot;disqus_thread&quot;&gt;&lt;/div&gt;
&lt;script&gt;
    /**
     *  RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
     *  LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables
     */
    /*
    var disqus_config = function () {
        this.page.url = PAGE_URL;  // Replace PAGE_URL with your page's canonical URL variable
        this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
    };
    */
    (function() {  // DON'T EDIT BELOW THIS LINE
        var d = document, s = d.createElement('script');
        
        s.src = '//kernel32.disqus.com/embed.js';
        
        s.setAttribute('data-timestamp', +new Date());
        (d.head || d.body).appendChild(s);
    })();
&lt;/script&gt;

&lt;noscript&gt;Please enable JavaScript to view the &lt;a href=&quot;https://disqus.com/?ref_noscript&quot; rel=&quot;nofollow&quot;&gt;comments powered by Disqus.&lt;/a&gt;&lt;/noscript&gt;
</description>
        <pubDate>Sat, 25 Jun 2016 00:00:00 +0000</pubDate>
        <link>https://kernel32.net/2016/06/25/xamarin-forms-transitions.html</link>
        <guid isPermaLink="true">https://kernel32.net/2016/06/25/xamarin-forms-transitions.html</guid>
        
        <category>Xamarin</category>
        
        <category>Xamarin.Forms</category>
        
        <category>iOS</category>
        
        <category>Android</category>
        
        <category>Mobile</category>
        
        <category>UI</category>
        
        <category>Transitions</category>
        
        <category>Animations</category>
        
        
      </item>
    
      <item>
        <title>EB Code explained</title>
        <description>&lt;p&gt;For a long time I, had a block of code on my &lt;a href=&quot;http://eurobear.net&quot;&gt;web site&lt;/a&gt;, that for many was hard to understand:&lt;/p&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;unsafe&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;a&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;fixed&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;char&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;p&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sc&quot;&gt;'b'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;Console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;WriteLine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;a&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//&quot;b&quot;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;What happens here is a little bit of optimization magic in the .Net CLR.
When having two equal strings hardcoded, the address in memory will be the same.
This is because .Net uses a string table, aka. an &lt;a href=&quot;https://msdn.microsoft.com/en-us/library/system.string.intern&quot;&gt;intern pool&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;By default, a new string created in runtime does not reference the same address, but you can put (or get the old) string on the pool by using the &lt;code&gt;string.Intern&lt;/code&gt; keyword.&lt;/p&gt;

&lt;p&gt;Se example:&lt;/p&gt;

&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;A&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;B&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;Object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ReferenceEquals&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;A&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Dump&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//True&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ab&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//&quot;AB&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ReferenceEquals&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ab&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;AB&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Dump&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//False&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ReferenceEquals&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;A&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;B&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;AB&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Dump&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//True&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;internString&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Intern&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Dump&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//&quot;AB&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Object&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ReferenceEquals&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;internString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;AB&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Dump&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//True&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;String are &lt;a href=&quot;https://msdn.microsoft.com/en-us/library/ms228362.aspx&quot;&gt;immutable&lt;/a&gt;, but by using the &lt;code&gt;unsafe&lt;/code&gt; keyword, you can actually manually change the content of it.
Be aware, as this opens for some attacks from libraries (or a colleague that want to mess with you) when it comes to things like reflection and connection strings.&lt;/p&gt;

&lt;div id=&quot;disqus_thread&quot;&gt;&lt;/div&gt;
&lt;script&gt;
    /**
     *  RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
     *  LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables
     */
    /*
    var disqus_config = function () {
        this.page.url = PAGE_URL;  // Replace PAGE_URL with your page's canonical URL variable
        this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
    };
    */
    (function() {  // DON'T EDIT BELOW THIS LINE
        var d = document, s = d.createElement('script');
        
        s.src = '//kernel32.disqus.com/embed.js';
        
        s.setAttribute('data-timestamp', +new Date());
        (d.head || d.body).appendChild(s);
    })();
&lt;/script&gt;

&lt;noscript&gt;Please enable JavaScript to view the &lt;a href=&quot;https://disqus.com/?ref_noscript&quot; rel=&quot;nofollow&quot;&gt;comments powered by Disqus.&lt;/a&gt;&lt;/noscript&gt;
</description>
        <pubDate>Sat, 25 Jun 2016 00:00:00 +0000</pubDate>
        <link>https://kernel32.net/2016/06/25/code-explained.html</link>
        <guid isPermaLink="true">https://kernel32.net/2016/06/25/code-explained.html</guid>
        
        <category>dotnet</category>
        
        
      </item>
    
      <item>
        <title>Welcome to Jekyll!</title>
        <description>&lt;p&gt;You’ll find this post in your &lt;code class=&quot;highlighter-rouge&quot;&gt;_posts&lt;/code&gt; directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run &lt;code class=&quot;highlighter-rouge&quot;&gt;jekyll serve&lt;/code&gt;, which launches a web server and auto-regenerates your site when a file is updated.&lt;/p&gt;

&lt;p&gt;To add new posts, simply add a file in the &lt;code class=&quot;highlighter-rouge&quot;&gt;_posts&lt;/code&gt; directory that follows the convention &lt;code class=&quot;highlighter-rouge&quot;&gt;YYYY-MM-DD-name-of-post.ext&lt;/code&gt; and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works.&lt;/p&gt;

&lt;p&gt;Jekyll also offers powerful support for code snippets:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;print_hi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Hi, &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;print_hi&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'Tom'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;#=&amp;gt; prints 'Hi, Tom' to STDOUT.&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Check out the &lt;a href=&quot;http://jekyllrb.com/docs/home&quot;&gt;Jekyll docs&lt;/a&gt; for more info on how to get the most out of Jekyll. File all bugs/feature requests at &lt;a href=&quot;https://github.com/jekyll/jekyll&quot;&gt;Jekyll’s GitHub repo&lt;/a&gt;. If you have questions, you can ask them on &lt;a href=&quot;https://talk.jekyllrb.com/&quot;&gt;Jekyll Talk&lt;/a&gt;.&lt;/p&gt;

&lt;div id=&quot;disqus_thread&quot;&gt;&lt;/div&gt;
&lt;script&gt;
    /**
     *  RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
     *  LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables
     */
    /*
    var disqus_config = function () {
        this.page.url = PAGE_URL;  // Replace PAGE_URL with your page's canonical URL variable
        this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
    };
    */
    (function() {  // DON'T EDIT BELOW THIS LINE
        var d = document, s = d.createElement('script');
        
        s.src = '//kernel32.disqus.com/embed.js';
        
        s.setAttribute('data-timestamp', +new Date());
        (d.head || d.body).appendChild(s);
    })();
&lt;/script&gt;

&lt;noscript&gt;Please enable JavaScript to view the &lt;a href=&quot;https://disqus.com/?ref_noscript&quot; rel=&quot;nofollow&quot;&gt;comments powered by Disqus.&lt;/a&gt;&lt;/noscript&gt;
</description>
        <pubDate>Mon, 20 Jun 2016 07:56:46 +0000</pubDate>
        <link>https://kernel32.net/jekyll/update/2016/06/20/welcome-to-jekyll.html</link>
        <guid isPermaLink="true">https://kernel32.net/jekyll/update/2016/06/20/welcome-to-jekyll.html</guid>
        
        
        <category>jekyll</category>
        
        <category>update</category>
        
      </item>
    
  </channel>
</rss>
