Click here to Skip to main content
15,916,215 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm new to wpf C# and I wanted to create a new TabItem in my MainWindow when I select the data in a separate window, is there a way to do that?

What I have tried:

Usercontrol TDados = new Usercontrol();
ClosableTab theTabItem = new ClosableTab();
theTabItem.Title = Dados._NomeCliente;
theTabItem.Content = TDados;
Updated 2-Sep-22 2:24am
Graeme_Grant 1-Sep-22 23:51pm    
You need to use data binding with a "data first" approach. Are you familiar with MVVM?
Rodrigo_F_P 2-Sep-22 7:19am    
I've heard of mvvm, but I haven't stopped to look yet, because I don't have much knowledge. Does mvvm have any simple approach that I can implement?

One solution might be to use IEventAggregator messaging;
IEventAggregator messaging[^]
Event Aggregator | Prism[^]
Share this answer
Graeme_Grant 1-Sep-22 23:50pm    
That is too advanced, as he states "I'm new to wpf C#"...
Rodrigo_F_P 2-Sep-22 7:23am    
I'm new to the language, I'm going to research about it but if you can explain to me how I would use it, it would be good
What is MVVM? Here is a great resource that covertis this topic and much more: SingletonSean WPF Playlists - YouTube[^]

Here are a couple more good WPF resources:
* The complete WPF tutorial[^]
* 2,000 Things You Should Know About WPF | Everything a WPF Developer Needs to Know, in Bite-Sized Chunks[^]
Share this answer

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