Tuesday, September 5, 2017

Injecting a new root element in a Xamarin Forms Content Page

If you want to insert a new root element on a content page (using Xamarin Forms) you must set the Content to null first before assigning it again. Otherwise touch events will not register (at least not on iOS).

For example, add the entire view in an AbsoluteLayout could look like this:

 // Get a reference to the content
 var content = page.Content;
 page.Content = null// This line is key

 // Create a new root element and add the content
 var absoluteLayout = new AbsoluteLayout();
 absoluteLayout.Children.Add(content);

 // Replace the content
 page.Content = absoluteLayout;

I would do this directly after the call to InitializeComponent() in the code behind of the view.


57 comments:

  1. You know your projects stand out of the herd. There is something special about them. It seems to me all of them are really brilliant! online marketing

    ReplyDelete
  2. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site. xamarin training in Chennai

    ReplyDelete
  3. Extraordinary blog. you put Good stuff. All the themes were clarified briefly.Thanks for sharing that post.Keep in blogging…
    No.1 Software Testing Training Institute in Chennai | Best Selenium Training Institute in Chennai | Web Designing Training Institute in Chennai

    ReplyDelete
  4. Great Article… I love to read your articles because your writing style is good, its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.
    Graphic Design Training Institute in Chennai | Graphic Design Training Institute in Velachery

    ReplyDelete
  5. Thank you for taking the time to provide us with your valuable information.keep sharing your post regularly..
    Certified Ethical Hacking Training in Chennai | Hacking Training in Saidapet

    ReplyDelete
  6. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging…
    Cisco CCNP Certification Exam Center in Chennai | Best CCNP Training in Alandur

    ReplyDelete
  7. Great Article… I love to read your articles because your writing style is good, its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.
    No.1 Microsoft Azure Training Institute in Chennai | No.1 Microsoft Azure Training Institute in Velachery

    ReplyDelete
  8. Thank you for taking the time to provide us with your valuable information.keep sharing your post regularly..
    Certified Ethical Hacking Training in Chennai | Blue Prism Training Institute in Chennai

    ReplyDelete
  9. Really it was an awesome article...very interesting to read..You have provided an nice article....Thanks for sharing..
    Cloud Computing Training Institute in Chennai | Cloud Computing Training Institute in Velachery

    ReplyDelete
  10. I wondered upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.
    xamarin classes
    best xamarin course

    ReplyDelete
  11. Nice blog. Thank you for sharing. The information you shared is very effective for learners I have got some important suggestions from it.
    CLOUD COMPUTING Classes in Chennai | CLOUD COMPUTING Courses in Velachery

    ReplyDelete
  12. These provided information was really so nice, thanks for giving that post and the more skills to develop after refer that post.
    Best Dotnet Training Institute in Chennai|Best Dotnet Training Institute in Velachery

    ReplyDelete
  13. I just found this blog and have high hopes for it to continue. Keep up the great work, its hard to find good ones. I have added to my favorites. Thank You.
    No.1 Automation Anywhere Training Institute in Chennai | No.1 Automation Anywhere Training Institute in Kanchipuram | No.1 Automation Anywhere Training Institute in Velachery

    ReplyDelete
  14. My rather long internet look up has at the end of the day been compensated with pleasant insight to talk about with my family and friends.
    No.1 Blue Prism Training Institute in Chennai | No.1 Blue Prism Training Institute in Velachery | No.1 Blue Prism Training Institute in Kanchipuram

    ReplyDelete
  15. I ‘d mention that most of us visitors are endowed to exist in a fabulous place with very many wonderful individuals with very helpful things.
    Automation Anywhere Training with Placement in Chennai | Automation Anywhere Training with Placement in Tambaram

    ReplyDelete
  16. I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this site.
    SEO Training Institute in Chennai | SEO Training Institute in Velachery

    ReplyDelete
  17. Nice Post! It is really interesting to read from the beginning & I would like to share your blog to my circles, keep your blog as updated.
    JAVA and J2EE Training Institute in Chennai | JAVA and J2EE Training Institute in Velachery

    ReplyDelete
  18. Hi, I am really happy to find such a helpful and fascinating post that is written in well manner. Thanks for sharing such an informative post.
    No.1 Automation Anywhere Training Institute in Chennai | No.1 Automation Anywhere Training Institute in Velachery

    ReplyDelete
  19. I ‘d mention that most of us visitors are endowed to exist in a fabulous place with very many wonderful individuals with very helpful things.
    No.1 Blue Prism Training Institute in Chennai | No.1 Blue Prism Training Institute in Kanchipuram

    ReplyDelete
  20. I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this site.
    Python Certification Course in Chennai | Python Certification Course in OMR

    ReplyDelete
  21. It's interesting that many of the bloggers to helped clarify a few things for me as well as giving. Most of ideas can be nice content.
    Best Cloud Computing Training Institute in Chennai |Best Cloud Computing Training Institute in Taramani

    ReplyDelete
  22. Thank you for taking the time to provide us with your valuable information. Keep sharing your post regularly..
    Blue Prism Robotic Process Automation in Chennai | Blue Prism Robotic Process Automation in Chennai

    ReplyDelete
  23. This comment has been removed by the author.

    ReplyDelete
  24. Nice Blog… Wonderful Information and really very much useful. Thanks for sharing and keep updating…
    Python Training Institute in Chennai | Python Training Institute in Velachery

    ReplyDelete
  25. I ‘d mention that most of us visitors are endowed to exist in a fabulous place with very many wonderful individuals with very helpful things.
    Python Exam Centers in Chennai | Python Exam Centers in Chennai

    ReplyDelete
  26. Awesome post. Really you are shared very informative concept... Thank you for sharing. Keep on updating...
    C and C++ Training in Chennai | C and C++ Training in Taramani

    ReplyDelete
  27. Really it was an awesome blog...... Very interesting to read, .It’s very helpful for me, Big thanks for the useful info and keep updating…
    CCNP Training Institute in Chennai | CCNP Training Institute in Velachery

    ReplyDelete
  28. Nice Post! It is really interesting to read from the beginning and Keep up the good work and continue sharing like this.
    Oracle Training in Chennai | Oracle Training in Kanchipuram

    ReplyDelete
  29. Your Blog is really amazing with useful information you are shared here...Thank you for sharing such an informative and awesome post with us. Keep blogging article like this……..
    AWS Training Institute in Chennai | AWS Training Institute in Velachery

    ReplyDelete
  30. Post is very informative… It helped me with great information so I really believe you will do much better in the future.
    Blueprism Exam Center in Chennai | Blueprism Exam Center in Velachery

    ReplyDelete
  31. Really I enjoy this blog….. Very nice post… Thanks for sharing and keep updating
    AWS Training Institute in Chennai | AWS Training Institute in Velachery

    ReplyDelete
  32. Your Blog is really awesome with useful and helpful content for us.Thanks for sharing ..keep updating more information..
    Best UIPath Training Institute in Chennai | Best UIPath Training Institute in Velachery

    ReplyDelete
  33. Thank you so much for sharing such an amazing post with useful information with us. Keep updating such a wonderful blog….
    Best CCNA Training Institute in Chennai| CCNA Training Center in Velachery

    ReplyDelete
  34. I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this site.
    Ethical Hacking Training Course in Chennai | Ethical Hacking Training Course in Nanganallur

    ReplyDelete
  35. Nice blog. Thank you for sharing. The information you shared is very effective for learners I have got some important suggestions from it…
    Best Dotnet Training Institute in Chennai |Best Dotnet Training Institute in Kanchipuram

    ReplyDelete
  36. Nice blog…. with lovely information. Really very useful article for us thanks for sharing such a wonderful blog. Keep updating…..
    Best Linux Training Institute in Pallikaranai| Best Linux Training Institute in Velachery

    ReplyDelete
  37. Awesome article…. Really very helpful information for us. Keep it up. Keep blogging. Looking to reading your next post,. Thank You for Sharing This Information
    Best PCB Training Institute in Taramani| Best PCB Training Institute in Velachery

    ReplyDelete
  38. Awesome article…. Really very helpful information for us. Keep it up. Keep blogging. Looking to reading your next post,. Thank You for Sharing This Information
    Best PCB Training Institute in Taramani| Best PCB Training Institute in Velachery

    ReplyDelete
  39. Awesome article…. Really very helpful information for us. Keep it up. Keep blogging. Looking to reading your next post,. Thank You for Sharing This Information
    Best PCB Training Institute in Taramani| Best PCB Training Institute in Velachery

    ReplyDelete
  40. Very informative blog. Thanks for sharing such good information and keep on updating.
    RPA Training in Chennai | RPA Training in Pallikaranai

    ReplyDelete
  41. Nice Blog… Wonderful Information and really very much useful. Thanks for sharing and keep updating…
    Automation Anywhere Training in Chennai | Automation Anywhere Training in Pallavaram

    ReplyDelete
  42. Good Post…. Thanks for the useful information it’s very useful to read your blog. Keep blogging article like this.
    Best JAVA/J2EE Training Institute in Perungudi| Best JAVA/J2EE Training Institute in Velachery

    ReplyDelete
  43. Nice blog, really I feel happy to see this useful blog… Thanks for sharing this valuable information to our vision....
    Best AWS Training Institute in Medavakkam| Best AWS Training Institute in Velachery

    ReplyDelete
  44. Nice..You have clearly explained about it ...Its very useful for me to know about new things..Keep on blogging..
    Blue prism Training in Chennai | Blue prism Training in Besant Nagar

    ReplyDelete
  45. Thank you so much for sharing such an amazing post with useful information with us. Keep updating such a wonderful blog….
    Ethical Hacking Training in Chennai | Ethical Hacking Training in ST. Thomas Mount

    ReplyDelete
  46. Really wonderful post.... My sincere thanks for sharing very useful information to the users... Please continue to share this kind of post
    Best Python Exams Center in OMR| Best Python Certification Exams in OMR

    ReplyDelete
  47. Thanks for sharing this valuable information.. I saw your website and get more details..Nice work...
    Graphic Designing Training in Chennai | Graphic Designing Training in Keelkattalai

    ReplyDelete
  48. Wonderful blog… You provided very interesting information here. I feel happy to read this post. I hope that you will write many posts like this… Thanks for sharing and Keep updating…..
    Python Training Institute in Chennai | Python Training Institute in Velachery

    ReplyDelete
  49. Thank you so much for sharing such an amazing post with useful information with us. Keep updating such a wonderful blog….
    UIPath Training in Chennai | UIPath Training in Kanchipuram

    ReplyDelete
  50. I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this site.
    RPA Training in Chennai | RPA Training in Pallavaram

    ReplyDelete