Click here to Skip to main content
15,908,274 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello I'm working on wpf
my Problem is the following :
I have an open wpf user control let's call it UC1
When the user clicks a button another wpf user Control (UC2) will open
he'll choose a button on which a text is written
I want to pass this button's content to UC1 without closing it and modify its content!


How can I do such thing?
Posted

I wouldn't pass the contents directly to another user control in such situation. Instead you could utilize the MVVM pattern.

Some links:
- MVVM Pattern Made Simple[^]
- WPF Apps With The Model-View-ViewModel Design Pattern[^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 3-Jan-12 21:40pm    
I agree, a 5, but there is a bit more to it, please see my answer.
--SA
I agree with Mika: you should pass data from data layer to controls and visa versa, not from control to control.

I also want to note that there is no such concept as "open control" or "close control", so it's not quite clear what are you even talking about.

—SA
 
Share this answer
 
Comments
Wendelius 4-Jan-12 1:23am    
That's true. The OP may refer to a control placed on a separate window or something like that... 5
Sergey Alexandrovich Kryukov 4-Jan-12 2:14am    
Sure. Thank you, Mika.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900