summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues
diff options
context:
space:
mode:
authorE.Z. Hart <hartez@users.noreply.github.com>2016-04-07 00:12:07 -0600
committerJason Smith <jason.smith@xamarin.com>2016-04-06 23:12:07 -0700
commitc98d338e15a29897e3a9a9d03d30dd3c70347925 (patch)
tree151819a41191d12609a5455c48e84be0b3879452 /Xamarin.Forms.Controls.Issues
parent1363f383b17d68fbafadc773b9f06f477f9744c9 (diff)
downloadxamarin-forms-c98d338e15a29897e3a9a9d03d30dd3c70347925.tar.gz
xamarin-forms-c98d338e15a29897e3a9a9d03d30dd3c70347925.tar.bz2
xamarin-forms-c98d338e15a29897e3a9a9d03d30dd3c70347925.zip
Force conversion to target type when Static Resource returns OnPlatform<T>
Diffstat (limited to 'Xamarin.Forms.Controls.Issues')
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39636.xaml40
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39636.xaml.cs47
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems10
3 files changed, 97 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39636.xaml b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39636.xaml
new file mode 100644
index 00000000..1f90ee85
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39636.xaml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<local:TestContentPage xmlns="http://xamarin.com/schemas/2014/forms"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ xmlns:local="clr-namespace:Xamarin.Forms.Controls"
+ x:Class="Xamarin.Forms.Controls.Issues.Bugzilla39636">
+
+ <local:TestContentPage.Resources>
+ <ResourceDictionary>
+
+ <OnPlatform
+ x:Key="SizeMedium"
+ x:TypeArguments="x:Double"
+ iOS="40"
+ Android="30"
+ WinPhone="60" />
+
+ <x:Double x:Key="SizeLarge">80</x:Double>
+
+ </ResourceDictionary>
+ </local:TestContentPage.Resources>
+
+ <local:TestContentPage.Content>
+ <StackLayout HorizontalOptions="Fill" VerticalOptions="Fill">
+ <Label Text="Success"></Label>
+ <Label Text="If there is a blue box and a red box below, this test has passed. If the application crashes, the test has not passed."></Label>
+ <BoxView HorizontalOptions="Center" VerticalOptions="Center" BackgroundColor="Blue" WidthRequest="{StaticResource SizeMedium}">
+ <BoxView.HeightRequest>
+ <OnPlatform
+ x:TypeArguments="x:Double"
+ iOS="40"
+ Android="30"
+ WinPhone="60" />
+ </BoxView.HeightRequest>
+ </BoxView>
+ <BoxView HorizontalOptions="Center" VerticalOptions="Center" BackgroundColor="Red" WidthRequest="{StaticResource SizeLarge}">
+
+ </BoxView>
+ </StackLayout>
+ </local:TestContentPage.Content>
+</local:TestContentPage> \ No newline at end of file
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39636.xaml.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39636.xaml.cs
new file mode 100644
index 00000000..45e2c8c8
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla39636.xaml.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+using Xamarin.Forms;
+using Xamarin.Forms.CustomAttributes;
+using Xamarin.Forms.Xaml;
+
+#if UITEST
+using Xamarin.Forms.Core.UITests;
+using Xamarin.UITest;
+using NUnit.Framework;
+#endif
+
+
+namespace Xamarin.Forms.Controls.Issues
+{
+ [Preserve(AllMembers = true)]
+ [Issue(IssueTracker.Bugzilla, 39636, "Cannot use XamlC with OnPlatform in resources, it throws System.InvalidCastException", PlatformAffected.All)]
+ #if APP
+ [XamlCompilation(XamlCompilationOptions.Compile)]
+ #endif
+ public partial class Bugzilla39636 : TestContentPage
+ {
+ public Bugzilla39636 ()
+ {
+#if APP
+ InitializeComponent ();
+#endif
+ }
+
+ protected override void Init()
+ {
+
+ }
+
+#if UITEST
+ [Test]
+ public void DoesNotCrash()
+ {
+ RunningApp.WaitForElement(q => q.Text("Success"));
+ }
+#endif
+ }
+}
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
index 93de60b1..3d745c38 100644
--- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
@@ -90,6 +90,10 @@
<DependentUpon>Bugzilla39463.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
+ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla39636.xaml.cs">
+ <DependentUpon>Bugzilla39636.xaml</DependentUpon>
+ <SubType>Code</SubType>
+ </Compile>
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla39702.cs" />
<Compile Include="$(MSBuildThisFileDirectory)CarouselAsync.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla34561.cs" />
@@ -507,4 +511,10 @@
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="$(MSBuildThisFileDirectory)Bugzilla39636.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+ </EmbeddedResource>
+ </ItemGroup>
</Project> \ No newline at end of file