Guest User

Untitled

a guest
Jan 16th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. var page = (Page)Activator.CreateInstance(item.TargetType);
  2.  
  3. Label titleViewLabel = new Label
  4. {
  5. Text = item.Title,
  6. FontAttributes = FontAttributes.Bold,
  7. FontSize = 25,
  8. TextColor = Color.White,
  9. BackgroundColor = backgroundColor,
  10. Margin = 10
  11. };
  12.  
  13. NavigationPage.SetTitleView(page, titleViewLabel);
  14.  
  15. private async void ProductView_OnItemSelected(object sender, SelectedItemChangedEventArgs args)
  16. {
  17. Product product = (Product)args.SelectedItem;
  18. ProductDetailPage productDetailPage = new ProductDetailPage
  19. {
  20. BindingContext = product,
  21. Title = product.Name
  22. };
  23.  
  24. await Navigation.PushAsync(productDetailPage);
  25. }
  26.  
  27. protected override void OnAppearing()
  28. {
  29. base.OnAppearing();
  30.  
  31. Label titleView = ((Label)NavigationPage.GetTitleView(this));
  32. // titleView.Text has "Products!!
  33. }
Add Comment
Please, Sign In to add comment