Reputation: 931
We have a Xamarin.Forms app we are converting from code behind to XAML. I have already used OnPlatform
successfully, but it is causing a crash when setting the scale of our ActivityIndicator. I am testing on the iOS simulator. Here's the code:
<ActivityIndicator IsRunning="True" Color="White" HorizontalOptions="Center" VerticalOptions="StartAndExpand">
<ActivityIndicator.Scale>
<OnPlatform x:TypeArguments="x:double" iOS="4.0" Android="3.0" />
</ActivityIndicator.Scale>
</ActivityIndicator>
In contrast, these two would work:
<ActivityIndicator IsRunning="True" Color="White" HorizontalOptions="Center" VerticalOptions="StartAndExpand">
<ActivityIndicator.Scale>
4.0
</ActivityIndicator.Scale>
</ActivityIndicator>
-
<ActivityIndicator IsRunning="True" Color="White" HorizontalOptions="Center" VerticalOptions="StartAndExpand" Scale="4.0">
</ActivityIndicator>
Upvotes: 3
Views: 1991
Reputation: 509
try this
<ActivityIndicator IsRunning="True" Color="White"
HorizontalOptions="Center" VerticalOptions="StartAndExpand">
<ActivityIndicator.Scale>
<OnPlatform x:TypeArguments="x:Double" iOS="4.0" Android="3.0" />
</ActivityIndicator.Scale>
</ActivityIndicator>
it's a Type argument. double isn't really the type, Double is.
Upvotes: 7
Reputation: 74184
Case sensitive on the Type:
Change:
<OnPlatform x:TypeArguments="x:double" iOS="4.0" Android="3.0" />
To:
<OnPlatform x:TypeArguments="x:Double" iOS="4.0" Android="3.0" />
FYI: Enable XAML compiling to catch these during compile time vs. run-time.
Upvotes: 4