OnPlatform UWP crash

NicolasKrierNicolasKrier FRMember ✭✭✭

Hello everyone,

When I need specific value for a given platform, I use OnPlatform.
If I wanted to set specific value for either UWP or Windows Phone, I used WinPhone.

Now it's not recognised anymore. I need to set UWP.
But when I use UWP, I got this error : No property, bindable property, or event found for 'UWP', or mismatching type between value and property.

Right now, to keep things buildable, I have to set the value for iOS and Android and use the default value for UWP.

This is boring as quite often my Android and iOS value are the same but is different on UWP. What I want to do is :

What am I missing ? Is it a know bug ? Should I fill a bug ?
Thank you

Tagged:

Best Answer

Answers

  • NicolasKrierNicolasKrier FRMember ✭✭✭
    edited October 2018

    @JohnHardman yea sorry I did but due to a wrong manipulation (go back page...)
    I lost all the pasted code and forget to paste it again :)
    Edit : I might not have forget. It's just the Xamarin forum text editor which collapse my code no matter what I do. So I've removed the first < otherwise the content is empty when I save this message...

    code before migration (worked well)
    OnPlatform x:TypeArguments="GridLength" WinPhone="1*" Default="Auto" />

    Doesn't compile : UWP throw XAML error : No property, bindable property, or event found for 'UWP', or mismatching type between value and property -->
    OnPlatform x:TypeArguments="GridLength" UWP="1*" Default="Auto" />

    Current hack : Default is used for UWP instead of being shared for iOS and Android
    OnPlatform x:TypeArguments="GridLength" Default="1*" Android="Auto" iOS="Auto" />

    Great new : this code work... Too bad because I prefer the previous code : less code to type and autocompletion for platform name whereas there isn't with this one...
    OnPlatform x:Key="ColumnWidth" x:TypeArguments="GridLength">
    On Platform="UWP">1*/On>
    On Platform="Default">Auto/On>
    /OnPlatform>

    That means I will have to change every OnPlatform I've used...
    I don't get why but XF learnt me to not overthink this kind of stuff :tongue:

    Thanks a lot and apologies. I should have tried that myself. I'm ashamed I didn't take 10sec to try before I wrote this message.

  • jezhjezh Member, Xamarin Team Xamurai

    @NicolasKrier
    Please post more detail or examples of code snippets.

  • NicolasKrierNicolasKrier FRMember ✭✭✭

    @jezh said:
    @NicolasKrier
    Please post more detail or examples of code snippets.

    Ah :) thanks for helping. Just refresh the page. I did past my code but each time I start a line with < the line gets empty at save

  • JohnHardmanJohnHardman GBUniversity mod

    @NicolasKrier said:
    I did past my code but each time I start a line with < the line gets empty at save

    Put three back-ticks on the line before the code (with nothing between them), and then three more back-ticks on the line after the code.

    On my keyboard the back-tick is on the key to the left of the '1' above the Qwerty part of the keyboard. If you cannot find it on your keyboard, there is one at the end of this sentence that you can copy and paste `

  • NicolasKrierNicolasKrier FRMember ✭✭✭

    @JohnHardman said:

    @NicolasKrier said:
    I did past my code but each time I start a line with < the line gets empty at save

    Put three back-ticks on the line before the code (with nothing between them), and then three more back-ticks on the line after the code.

    On my keyboard the back-tick is on the key to the left of the '1' above the Qwerty part of the keyboard. If you cannot find it on your keyboard, there is one at the end of this sentence that you can copy and paste `

    Thanks. I knew it but forgot because I was inactive for a little while :D

    Do you have any idea why the one shot OnPlatform doesn't work (without xml children : every value set on attributs) while with children works ?

Sign In or Register to comment.