/// <summary> /// Called when [loaded]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param> private void OnLoaded(object sender, System.Windows.RoutedEventArgs e) { if (this.app == null) { this.app = new MainApp((int)this.ActualWidth, (int)this.ActualHeight); this.image = this.app.Configure() as D3DImage; this.InvalidateVisual(); this.UpdateLayout(); } if (this.counters == 0) { this.SizeChanged += this.OnSizeChanged; CompositionTargetEx.Rendering += this.CheckInit; this.counters++; } }