1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
using System.Collections.Generic;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
#endif
namespace Xamarin.Forms.Controls.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 47923, "Vectors don\'t work in Images, and work badly in Buttons", PlatformAffected.Android)]
public class Bugzilla47923 : TestNavigationPage // or TestMasterDetailPage, etc ...
{
protected override void Init()
{
PushAsync(new LandingPage());
}
}
public class VectorImagePage : ContentPage
{
public VectorImagePage(Aspect aspect)
{
var scrollView = new ScrollView();
var stackLayout = new StackLayout
{
Orientation = StackOrientation.Vertical,
Spacing = 10
};
var vectors = new[] { "cartman", "heart", "error" };
for (var i = 0; i < vectors.Length; i++)
{
for (var j = 0; j < 3; j++)
{
var image = new Image
{
Source = vectors[i],
WidthRequest = j == 1 ? 150 : 300,
HeightRequest = j == 2 ? 150 : 300,
BackgroundColor = i == 0 ? Color.Red : (i == 1 ? Color.Green : Color.Yellow),
HorizontalOptions = LayoutOptions.Center,
Aspect = aspect
};
stackLayout.Children.Add(image);
}
}
scrollView.Content = stackLayout;
Content = scrollView;
}
}
public class CellViewPage : ContentPage
{
public CellViewPage()
{
var list = new List<int>();
for (var i = 0; i < 50; i++)
list.Add(i);
var listView = new ListView
{
ItemsSource = list,
ItemTemplate = new DataTemplate(() => new ImageCell { ImageSource = "cartman" })
};
Content = listView;
}
}
public class LandingPage : ContentPage
{
public LandingPage()
{
var scrollView = new ScrollView();
var stackLayout = new StackLayout
{
Orientation = StackOrientation.Vertical,
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
Spacing = 10
};
var button1 = new Button
{
Text = "AspectFit",
Command = new Command(() => { Navigation.PushAsync(new VectorImagePage(Aspect.AspectFit)); }),
HorizontalOptions = LayoutOptions.Center
};
stackLayout.Children.Add(button1);
var button2 = new Button
{
Text = "AspectFill",
Command = new Command(() => { Navigation.PushAsync(new VectorImagePage(Aspect.AspectFill)); }),
HorizontalOptions = LayoutOptions.Center
};
stackLayout.Children.Add(button2);
var button3 = new Button
{
Text = "Fill",
Command = new Command(() => { Navigation.PushAsync(new VectorImagePage(Aspect.Fill)); }),
HorizontalOptions = LayoutOptions.Center
};
stackLayout.Children.Add(button3);
var button4 = new Button
{
Text = "Test cell views",
Command = new Command(() => { Navigation.PushAsync(new CellViewPage()); }),
HorizontalOptions = LayoutOptions.Center
};
stackLayout.Children.Add(button4);
scrollView.Content = stackLayout;
Content = scrollView;
}
}
}
|