@@ -81,6 +81,7 @@ public class HtmlControl : Control
8181 public static readonly DependencyProperty BaseStylesheetProperty = DependencyProperty . Register ( "BaseStylesheet" , typeof ( string ) , typeof ( HtmlControl ) , new PropertyMetadata ( null , OnDependencyProperty_valueChanged ) ) ;
8282 public static readonly DependencyProperty TextProperty = DependencyProperty . Register ( "Text" , typeof ( string ) , typeof ( HtmlControl ) , new PropertyMetadata ( null , OnDependencyProperty_valueChanged ) ) ;
8383
84+ public static readonly RoutedEvent LoadCompleteEvent = EventManager . RegisterRoutedEvent ( "LoadComplete" , RoutingStrategy . Bubble , typeof ( RoutedEventHandler < EventArgs > ) , typeof ( HtmlControl ) ) ;
8485 public static readonly RoutedEvent LinkClickedEvent = EventManager . RegisterRoutedEvent ( "LinkClicked" , RoutingStrategy . Bubble , typeof ( RoutedEventHandler < HtmlLinkClickedEventArgs > ) , typeof ( HtmlControl ) ) ;
8586 public static readonly RoutedEvent RenderErrorEvent = EventManager . RegisterRoutedEvent ( "RenderError" , RoutingStrategy . Bubble , typeof ( RoutedEventHandler < HtmlRenderErrorEventArgs > ) , typeof ( HtmlControl ) ) ;
8687 public static readonly RoutedEvent RefreshEvent = EventManager . RegisterRoutedEvent ( "Refresh" , RoutingStrategy . Bubble , typeof ( RoutedEventHandler < HtmlRefreshEventArgs > ) , typeof ( HtmlControl ) ) ;
@@ -99,13 +100,24 @@ protected HtmlControl()
99100 SnapsToDevicePixels = false ;
100101
101102 _htmlContainer = new HtmlContainer ( ) ;
103+ _htmlContainer . LoadComplete += OnLoadComplete ;
102104 _htmlContainer . LinkClicked += OnLinkClicked ;
103105 _htmlContainer . RenderError += OnRenderError ;
104106 _htmlContainer . Refresh += OnRefresh ;
105107 _htmlContainer . StylesheetLoad += OnStylesheetLoad ;
106108 _htmlContainer . ImageLoad += OnImageLoad ;
107109 }
108110
111+ /// <summary>
112+ /// Raised when the set html document has been fully loaded.<br/>
113+ /// Allows manipulation of the html dom, scroll position, etc.
114+ /// </summary>
115+ public event RoutedEventHandler LoadComplete
116+ {
117+ add { AddHandler ( LoadCompleteEvent , value ) ; }
118+ remove { RemoveHandler ( LoadCompleteEvent , value ) ; }
119+ }
120+
109121 /// <summary>
110122 /// Raised when the user clicks on a link in the html.<br/>
111123 /// Allows canceling the execution of the link.
@@ -371,6 +383,15 @@ protected override void OnKeyDown(KeyEventArgs e)
371383 _htmlContainer . HandleKeyDown ( this , e ) ;
372384 }
373385
386+ /// <summary>
387+ /// Propagate the LoadComplete event from root container.
388+ /// </summary>
389+ protected virtual void OnLoadComplete ( EventArgs e )
390+ {
391+ RoutedEventArgs newEventArgs = new RoutedEvenArgs < EventArgs > ( LoadCompleteEvent , this , e ) ;
392+ RaiseEvent ( newEventArgs ) ;
393+ }
394+
374395 /// <summary>
375396 /// Propagate the LinkClicked event from root container.
376397 /// </summary>
@@ -482,6 +503,14 @@ private static void OnDependencyProperty_valueChanged(DependencyObject dependenc
482503
483504 #region Private event handlers
484505
506+ private void OnLoadComplete ( object sender , EventArgs e )
507+ {
508+ if ( CheckAccess ( ) )
509+ OnLoadComplete ( e ) ;
510+ else
511+ Dispatcher . Invoke ( new Action < HtmlLinkClickedEventArgs > ( OnLinkClicked ) , e ) ;
512+ }
513+
485514 private void OnLinkClicked ( object sender , HtmlLinkClickedEventArgs e )
486515 {
487516 if ( CheckAccess ( ) )
0 commit comments