Skip to main content

Microsoft Silverlight

Too many loaded events on pageRSS Feed

(0)

mtiede@swtechnologies.com
mtiede@s...

Member

Member

148 points

275 Posts

Too many loaded events on page

I navigate to a page.  The Loaded event handler is called.  I have a button that, when clicked, navigates to another page.  After clicking the button, I see the other pages constructor called, then a user control on that page constructor is called, then the Loaded event handler of the original page is called AGAIN.  Wha'ts up with that?  Why would it be called again and how can I tell the difference between the two.

Here is all I do in the button click:

      NavigationService.Navigate( new Uri(  'MyPage?Edit=1', UriKind.Relative ) );

 The only thing I can think is that the TransitionContentControl that is supposed to fade from one to the other is reloading the one it is fading from...

slouge
slouge

Member

Member

6 points

6 Posts

Re: Too many loaded events on page

public YourView()

{

InitializeComponent();

Loaded += new RoutedEventHandler(OnLoaded);

}

void OnLoaded(object sender, RoutedEventArgs e)

{

Loaded -= new RoutedEventHandler(OnLoaded);

//your stuff

}
 

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities