[forms-devel] OnPlatform and Windows

Daniel Hindrikes daniel at hindrikes.se
Tue Jun 14 21:17:10 UTC 2016

Should I create a proposal for the xaml extension? Or what do you think about it?

Best regards,

Från: daniel at hindrikes.se
Skickat: den 1 juni 2016 23:18
Till: Jason Smith
Kopia: Forms devel
Ämne: Re: [forms-devel] OnPlatform and Windows

But if support is added for Windows and if no value is specified the value for WinPhone can be used? It makes it possible to have both a WinRT (8.1 or UWP)  version and still support a old silverlight app and will be backward compatible.
What do you think about a markup extension for OnPlatform? Like this:
    <ContentView BackgroundColor="Blue" Padding="{OnPlatform iOS='20,10,20,0', Android='20,10,20,0' Windows='20,10,20,0'}">
      <Label Text="Hello" FontAttributes="Bold" TextColor="{OnPlatform Red, Windows=Purple}" VerticalOptions="Center" HorizontalOptions="Center" />
With this extension you can specify a "default" value or a platform specific value. The default value will be used for all platforms that not have been specified.
A draft for the extension can be found here, https://github.com/dhindrik/Xamarin.Forms/blob/OnPlatform/Xamarin.Forms.Xaml/MarkupExtensions/OnPlatformExtension.cs
Best regards,
2016-05-31 20:39 skrev Jason Smith:
It has to do with the poor API design of that particular API. Generally speaking we had large problems expanding that API to support Windows without breaking backwards compatibility. We are looking into potentially providing a full out replacement for it in the future and simply obsoleting the old one (it will never get actually removed, just marked so people see that something better is out there). 

On Tue, May 31, 2016 at 1:59 AM, <daniel at hindrikes.se> wrote:
What is the reason that Device.OS is returning WinPhone when running it on WP Silverlight and Windows for WinRT when only WinPhone when using OnPlatform?
I guess it will be a breaking change to fix that because many have probably used WinPhone for their WinRT apps. But it have been good to have support for Windows and OnPlatform as well when developing apps for UWP. Especially if you already have Silverlight apps and want's to add support for UWP. It will also be more clear what to use, to use WinPhone for an app that is for tablet or desktop feels wrong.
Best regards,

forms-devel mailing list
forms-devel at lists.xamarin.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/forms-devel/attachments/20160614/3e035ef8/attachment.html>

More information about the forms-devel mailing list