SOLVED

Passing variable to custom controls .NET MAUI

Copper Contributor

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.

2 Replies

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

best response confirmed by WMLCJosh (Copper Contributor)
Solution

@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. 

1 best response

Accepted Solutions
best response confirmed by WMLCJosh (Copper Contributor)
Solution

@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. 

View solution in original post