[forms-devel] OnPlatform and Windows

daniel at hindrikes.se daniel at hindrikes.se
Wed Jun 1 21:18:11 UTC 2016


 

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: 

 <StackLayout> 

 <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" /> 

 </ContentView>


 </StackLayout> 

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, 

Daniel 

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). 
> 
> Jason 
>

> On Tue, May 31, 2016 at 1:59 AM, <daniel at hindrikes.se> wrote:
> 
>>
Hi, 
>> 
>> 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, 
>> 
>> Daniel 
>> 
>>
_______________________________________________
>> forms-devel mailing
list
>> forms-devel at lists.xamarin.com
>>
http://lists.ximian.com/mailman/listinfo/forms-devel [1]



Links:
------
[1]
http://lists.ximian.com/mailman/listinfo/forms-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/forms-devel/attachments/20160601/a1604e0d/attachment-0001.html>


More information about the forms-devel mailing list