Forum Discussion

WMLCJosh's avatar
WMLCJosh
Copper Contributor
Aug 15, 2022
Solved

Passing variable to custom controls .NET MAUI

So I'm working on an application that allows the user to create a note and attach it to various entities.  Because of this I created the note creation as a ContentView in my .NET MAUI project then I can display it wherever I need it instead of recreating it each time.  Is there a way to pass a variable (i.e. contact id from the create contacts page) to the ContentView?  4 days of digging and so far haven't found anything close.

  • LanHuang I actually did figure it out. The easiest way i found was using MessegeCenter when the button was clicked. I added the model into the message from the view and simply subscribed from the control. 

2 Replies

  • LanHuang's avatar
    LanHuang
    Former Employee

    Hi WMLCJosh,

    Thanks for posting your issue here.

    However this platform is used for how-to discussions and sharing best practices for building any app with .NET.Since your issue is a technical question, welcome to post it in Microsoft Q&A forum, the support team and communities on Microsoft Q&A will help you for any technical questions.
    Besides, it will be appreciated if you can share it here once you post this technical question Microsoft Q&A.
    Best Regards,
    Lan Huang

    • WMLCJosh's avatar
      WMLCJosh
      Copper Contributor

      LanHuang I actually did figure it out. The easiest way i found was using MessegeCenter when the button was clicked. I added the model into the message from the view and simply subscribed from the control. 

Resources