summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/DataTemplateGridImageTest.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/DataTemplateGridImageTest.cs')
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/DataTemplateGridImageTest.cs55
1 files changed, 55 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/DataTemplateGridImageTest.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/DataTemplateGridImageTest.cs
new file mode 100644
index 00000000..75de0ed7
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/DataTemplateGridImageTest.cs
@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using Xamarin.Forms.CustomAttributes;
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve (AllMembers = true)]
+ [Issue (IssueTracker.None, 0, "Images in DataTemplates with Grids don't show until resize on UWP",
+ PlatformAffected.WinRT)]
+ public class DataTemplateGridImageTest : TestContentPage
+ {
+ protected override void Init ()
+ {
+ var instructions = new Label { FontSize = 24, Text = "The first ListView below should have a Xamarin logo visible in it. The second should have a pink image with white writing. If either image is not displayed, this test has failed." };
+
+ ImageSource remoteSource =
+ ImageSource.FromUri (new Uri ("https://xamarin.com/content/images/pages/branding/assets/xamagon.png"));
+ ImageSource localSource = ImageSource.FromFile ("oasis.jpg");
+
+ var remoteImage = new Image { Source = remoteSource, BackgroundColor = Color.Red };
+ var localImage = new Image { Source = localSource, BackgroundColor = Color.Red };
+
+ var listViewRemoteImage = new ListView {
+ BackgroundColor = Color.Green,
+ ItemTemplate = new DataTemplate (() => new TestCellGridImage (remoteImage)),
+ ItemsSource = new List<string> { "1" }
+ };
+
+ var listViewLocalImage = new ListView {
+ BackgroundColor = Color.Green,
+ ItemTemplate = new DataTemplate (() => new TestCellGridImage (localImage)),
+ ItemsSource = new List<string> { "1" }
+ };
+
+ Content = new StackLayout {
+ Children = {
+ instructions,
+ listViewRemoteImage,
+ listViewLocalImage
+ }
+ };
+ }
+
+ [Preserve (AllMembers = true)]
+ public class TestCellGridImage : ViewCell
+ {
+ public TestCellGridImage (View image)
+ {
+ var grid = new Grid { BackgroundColor = Color.Yellow, WidthRequest = 200, HeightRequest = 200 };
+ grid.Children.Add (image);
+ View = grid;
+ }
+ }
+ }
+} \ No newline at end of file