I want to run some code when the Window or Control is first displayed. I can’t use Loaded because that can fire more than once. I can’t use Initialized because that is done by the constructor.
Is there an event somewhere between?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Unfortunately there is no such event. You can use a boolean in the Loaded Method to make sure your stuff only fires once –
Check out the WPF Windows lifetime events here:
http://msdn.microsoft.com/en-us/library/ms748948.aspx#Window_Lifetime_Events
(source: microsoft.com)