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?
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?
Unfortunately there is no such event. You can use a boolean in the Loaded Method to make sure your stuff only fires once -
if(!IsSetUp)
{
MySetUpFunction();
IsSetUp = true;
}
Check out the WPF Windows lifetime events here:
http://msdn.microsoft.com/en-us/library/ms748948.aspx#Window_Lifetime_Events