In my scenario, i have about 30-40 two way binding xaml controls like TextBox, ComboBox etc. in my UserControl. All the XAML controls will not be shown at the same time. Instead it will be displayed only based on the value named EntityName. If the EntityName is User, then the XAML controls related for User will be shown. All the XAML controls are not in sequential order among the Entity, Hence I will not able to put all the controls in a Grid and load based on x:Load. Also I dont want to load all the XAML controls for showing only 5 controls for any entity.
i) I have tried adding these controls in UserControl resources with x:key and add the required controls to the stackpanel from code behind. But the app crashes because of two way binding in it.
ii) I have tried the same with x:Name. But using x:Name will load all the controls initially. (if i am right.... ?)
As a summary, I need a sample solution on how to load two-way binding controls to a Usercontrol based on a value without loading other non-required controls.