How to call an empty UserControl with Uri from Link

May 20, 2013 at 3:56 AM
The issue is that I need to bring an empty UserControl every time I access to it.

The example of how I use this is:
ModernTab myTab = new ModernTab();
Link myLink = new Link();
Uri myUri = new Uri("Path/UserControl.xaml", UriKind.Relative);
myLink.DisplayName = "My New Link";
myLink.Source = myUri;

But when I move to one user control and make some changes (i.e. add some text to an textBox) and move to another userControl, when I come back it has the same change, but I want that every time I acces to this userControl it be empty againg.

I tried to handle this with the GotFocus() property of the tab and set again the source to the link but it doesn't call againg the user control and mantain the data.

Thank you.
May 20, 2013 at 2:09 PM
Assign attached property ModernFrame.KeepAlive = false to your usercontrol XAML like so:
<UserControl .. 
May 21, 2013 at 1:46 AM
Problem solved.

Thank you :)