tags:

views:

2

answers:

0

I have contentTemplateSelector that I use to display different datatemplates that contain usercontrols. I have a combobox that i use to trigger the event. When a user select a comboboxitem I use the TAG to inform the contentTemplateSelector what user control is being initialized.

case (int)AlertCodeTriggerEnum.AlertEvent: mEventControl = new EventControl(); mEventControl.Tag = "EVENTCONTROL"; mEventControl.DataContext = mEventEntity; mEventControl.ListBoxCollection = mContactCollection; mLoadSubControl.Content = mEventControl; break;

The problem that I am having is that the properties that I am setting on the usercontrol are all being set to null. And that is because I am creating a new instance and the ContentTemplateSelector is also creating a new instance. Is there away for me to not allow ContentTemplateSelector to create an instance if I have already does that with behind code.