1

I have an application which uses WPF + Page Navigation. The application and the flow is working fine and not an issue. But recently, while doing some tests, I found the following behaviour in the code.

I have used NavigationServices.Navigate(new Class());

When I trigger this function the page does gets navigated properly, but it executes certain events even before loading the page completely.

Example:

Under the class constructor and very next line after InitializeComponent(); I have enabled an radioButton and this radioButton has event checked enabled. So based on this the logic is executed first even before the UI is loaded completely in the frame.

My question: How do I stop all the events for time period and make sure the UI is loaded completely and then the events fires-up.

1 Answer 1

0

Use the Window.Loaded event; that fires once all UI components are ready.

Occurs when the element is laid out, rendered, and ready for interaction.

public MyWindow() { InitializeComponent(); this.Loaded += MyWindow_Loaded; } private void MainWindow_Loaded(object sender, RoutedEventArgs e) { // initialization stuff ... } 
Sign up to request clarification or add additional context in comments.

1 Comment

The behaviour has changed but still get the blank screen and the event is exectued and then the UI is made visible any method to take care this issue?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.