Guest User

Untitled

a guest
Apr 22nd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. <ListView x:Name="listView" ItemsSource="{Binding}" ItemSelected="ListView_ItemSelected">
  2. <ListView.ItemTemplate>
  3. <DataTemplate>
  4. <ViewCell>
  5. <ViewCell.View>
  6. <StackLayout Orientation="Horizontal">
  7. <Label Text="{Binding NameBook}" FontSize="Medium" />
  8. </StackLayout>
  9. </ViewCell.View>
  10. </ViewCell>
  11. </DataTemplate>
  12. </ListView.ItemTemplate>
  13. </ListView>
  14.  
  15. <ListView x:Name="listView" ItemsSource="{Binding}" ItemSelected="ListView_ItemSelected">
  16.  
  17. listView.SetBinding(ListView.ItemsSourceProperty, new Binding("."));
  18.  
  19. listView.SetBinding(ListView.ItemsSourceProperty, new Binding() {Source = this});
  20.  
  21. Label label = new Label()
  22. {
  23. FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label))
  24. };
  25.  
  26. label.SetBinding(Label.TextProperty, "NameBook");
  27.  
  28. sl = new StackLayout()
  29. {
  30.  
  31. };
  32.  
  33. listView = new ListView()
  34. {
  35. ItemTemplate = new DataTemplate(() =>
  36. {
  37. return new ViewCell
  38. {
  39. View = new StackLayout
  40. {
  41. Orientation = StackOrientation.Horizontal,
  42. Children =
  43. {
  44. label
  45. }
  46. }
  47. };
  48. })
  49. };
  50.  
  51. listView.SetBinding(ListView.ItemsSourceProperty, new Binding("."));
  52. listView.ItemSelected += ListView_ItemSelected;
  53.  
  54. Button btn = new Button()
  55. {
  56. Text = "Добавить"
  57. };
  58.  
  59. btn.Pressed += CreateFriend;
  60.  
  61. sl.Children.Add(listView);
  62. sl.Children.Add(btn);
  63. Content = sl;
Add Comment
Please, Sign In to add comment