I´m creating a smal WPF-Application with 5 Tabs and I´m wondering if it´s a good idea to seperate the tabs into UserControls. I think it is nice because my XAML-Code is about 400 alines and grows but at the other side i think it´s much work to pass the events to my main window and slows it down. Maybe i could work with the events at the UserControls but then I need solutions to have access to variables in my main window.
So what would you recommend me?
It really depends on how simple your application is and how resilient to change it needs to be. If this is a throw away app then no, you don’t need to split things out into user controls, but it may make your life a bit easier. We can’t tell you what you should do because we don’t know your requirements, but creating a user control will definitely make your code easier to change in the future (or during development even) if needed.
Since you mentioned that this is a relatively small app, use this as a general rule; the moment that managing the controls in each tab becomes a problem, wrap them in a UserControl.
It’s not a lot of work and it definitely isn’t going to cause performance problems.