Welcome to our Microsoft Q&A platform!
UserControl is to better achieve the reuse of code and controls, which has significant advantages in code maintenance.
Application performance does not depend on how many Xaml files you have created, but depends on how many controls are running in the application at the same time. So creating some
UserControl files has no direct impact on application performance.
Hi, If the code you are talking about is C # code, you can consider extracting it and creating a new static class as a global processing module. Other controls can call this method through this static class. If it's XAML code, yes, you can create another
Im speaking about XAML code. If i create a new usercontrols for all the small redundant xaml codes, it results in running many controls at the same time. As u said earlier, will it affect the app performance ? If yes, then how will you say that creating the usercontrols in my case is a recommended one ? @Richard Zhang-MSFT
An application is like a car, and controls are like cargo. The more cargo loaded, the slower the car will be. But this is just a general statement. The performance of an app is determined by many factors, not only the number of controls. Extract a part of the duplicate code to make a
UserControl. It is more meaningful to help you perform later maintenance and will not have a special impact on application performance.
Sign in to comment