Is there a way to make UserControl a singleton?
ex:
I have a MainWindow and 2 UserControls {UserControl 'A' and UserControl 'B'}
MainWindow have 2 Buttons {Button 'UCA' and Button 'UCB'}
UserControl 'A' have a TextBox.
At startup I have UserControl 'A' loaded to MainWindow.
When I click Button 'UCB', UserControl 'B' will replace UserControl 'A' and when I click Button 'UCA', UserControl 'A' will replace UserControl 'B'.
My question is:
When UserControl 'A' is activated, I type "Test" on TextBox, then I switched to UserControl 'B'. I want when I switched back to UserControl 'A' the text on TextBox is still there. My solution is to create singleton UserControl but I don't know how to do that.
NB: Above is just simple example, what I want to achieve is more complicated than just maintain a text in TextBox when switched between UserControl. But, the point is how to call the same instance of UserControl without created a new one.