diff options
Diffstat (limited to 'Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla21501.cs')
-rw-r--r-- | Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla21501.cs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla21501.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla21501.cs new file mode 100644 index 00000000..a9b896a5 --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla21501.cs @@ -0,0 +1,47 @@ +using System; +using Xamarin.Forms.CustomAttributes; +using System.Collections.Generic; + +namespace Xamarin.Forms.Controls +{ + [Preserve (AllMembers=true)] + [Issue (IssueTracker.Bugzilla, 21501, "ListView: Button in ItemTemplate breaks SelectedItem",PlatformAffected.Android)] + public class Bugzilla21501 : ContentPage + { + public Bugzilla21501 () + { + var stringList = new List<string> () { "abc", "xyz", "todo" }; + + var resultLabel = new Label () { Text = "A" }; + + var listView = new ListView (); + listView.ItemsSource = stringList; + listView.ItemTemplate = new DataTemplate (() => { + var label = new Label (); + label.SetBinding (Label.TextProperty, "."); + + var button = new Button () { Text = "Test" }; + + return new ViewCell { + View = new StackLayout { + Padding = new Thickness (0, 5), + Orientation = StackOrientation.Horizontal, + Children = { label, button } + } + }; + }); + + listView.ItemSelected += (sender, args) => { + resultLabel.Text = resultLabel.Text + "!"; + }; + + var layout = new StackLayout () { + Orientation = StackOrientation.Vertical, + Children = { listView, resultLabel } + }; + + Content = layout; + } + } +} + |