-
-
Save samhouts/f213069c2eaf08370b7ffc8e435df3c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Linq; | |
using Xamarin.Forms.CustomAttributes; | |
using Xamarin.Forms.Internals; | |
namespace Xamarin.Forms.Controls | |
{ | |
[Preserve(AllMembers = true)] | |
[Issue(IssueTracker.Bugzilla, 9936097, "Images Are Not Rendered When Inside A Layout Used In A DataTemplate", PlatformAffected.WinRT)] | |
public class Bugzilla36097 : TestTabbedPage | |
{ | |
protected override void Init() | |
{ | |
Children.Add(new NavigationPage(new ContentPage | |
{ | |
Content = new ListView | |
{ | |
RowHeight = 100, | |
ItemTemplate = new DataTemplate(() => | |
{ | |
var grid = new Grid | |
{ | |
VerticalOptions = LayoutOptions.FillAndExpand, | |
HorizontalOptions = LayoutOptions.FillAndExpand, | |
}; | |
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); | |
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); | |
grid.RowDefinitions.Add(new RowDefinition { Height = 100 }); | |
var image1 = new Image { Source = ImageSource.FromFile("photo.jpg"), Aspect = Aspect.AspectFit }; | |
var image2 = new Image { Source = ImageSource.FromFile("photo.jpg"), Aspect = Aspect.AspectFit }; | |
grid.AddChild(image1, column: 0, row: 0); | |
grid.AddChild(image2, column: 1, row: 0); | |
return new ViewCell | |
{ | |
View = grid | |
}; | |
}), | |
ItemsSource = Enumerable.Range(0, 100) | |
} | |
}) | |
{ Title = "Grid * Columns" }); | |
Children.Add(new NavigationPage(new ContentPage | |
{ | |
Content = new ListView | |
{ | |
RowHeight = 100, | |
ItemTemplate = new DataTemplate(() => | |
{ | |
var image1 = new Image { Source = ImageSource.FromFile("photo.jpg"), Aspect = Aspect.AspectFit }; | |
var label = new Label(); | |
label.SetBinding(Label.TextProperty, "."); | |
var absoluteLayout = new AbsoluteLayout(); | |
absoluteLayout.Children.Add(image1, bounds: new Rectangle(0, 0, 1, 1), flags: AbsoluteLayoutFlags.All); | |
absoluteLayout.Children.Add(label, bounds: new Rectangle(1, .1, .2, .2), flags: AbsoluteLayoutFlags.All); | |
return new ViewCell | |
{ | |
View = absoluteLayout | |
}; | |
}), | |
ItemsSource = Enumerable.Range(0, 100) | |
} | |
}) | |
{ Title = "Absolute Layout" }); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment