@@ -32,6 +32,7 @@ abstract class BaseByte : FrameworkElement, IByteControl
3232private ByteAction _action = ByteAction . Nothing ;
3333private IByte _byte ;
3434private bool _isHighLight ;
35+ private bool _tooltipLoaded ;
3536 #endregion global class variables
3637
3738 #region Events
@@ -66,26 +67,7 @@ protected BaseByte(HexEditor parent)
6667//Parent hexeditor
6768_parent = parent ?? throw new ArgumentNullException ( nameof ( parent ) ) ;
6869
69- #region Binding tooltip
70-
71- LoadDictionary ( "/WPFHexaEditor;component/Resources/Dictionary/ToolTipDictionary.xaml" ) ;
72- var txtBinding = new Binding
73- {
74- Source = FindResource ( "ByteToolTip" ) ,
75- UpdateSourceTrigger = UpdateSourceTrigger . PropertyChanged ,
76- Mode = BindingMode . OneWay
77- } ;
78-
79- // Load ressources dictionnary
80- void LoadDictionary ( string url )
81- {
82- var ttRes = new ResourceDictionary { Source = new Uri ( url , UriKind . Relative ) } ;
83- Resources . MergedDictionaries . Add ( ttRes ) ;
84- }
85-
86- SetBinding ( ToolTipProperty , txtBinding ) ;
87-
88- #endregion
70+ ToolTip = "." ;
8971
9072//Default properties
9173DataContext = this ;
@@ -346,6 +328,37 @@ public virtual void Clear()
346328
347329 #endregion
348330
331+ #region Binding tooltip
332+
333+ /// <summary>
334+ /// Load tooltip if necessary
335+ /// Hex editor is more faster when tootip is not loaded at creation
336+ /// </summary>
337+ internal void LoadToolTip ( )
338+ {
339+ if ( _tooltipLoaded ) return ;
340+
341+ LoadDictionary ( "/WPFHexaEditor;component/Resources/Dictionary/ToolTipDictionary.xaml" ) ;
342+
343+ // Load ressources dictionnary (can be moved outside if needed...)
344+ void LoadDictionary ( string url )
345+ {
346+ var ttRes = new ResourceDictionary { Source = new Uri ( url , UriKind . Relative ) } ;
347+ Resources . MergedDictionaries . Add ( ttRes ) ;
348+ }
349+
350+ SetBinding ( ToolTipProperty , new Binding
351+ {
352+ Source = FindResource ( "ByteToolTip" ) ,
353+ UpdateSourceTrigger = UpdateSourceTrigger . PropertyChanged ,
354+ Mode = BindingMode . OneWay
355+ } ) ;
356+
357+ _tooltipLoaded = true ;
358+ }
359+
360+ #endregion
361+
349362 #region Events delegate
350363
351364/// <summary>
@@ -438,6 +451,8 @@ protected override void OnToolTipOpening(ToolTipEventArgs e)
438451{
439452if ( Byte == null || ! _parent . ShowByteToolTip )
440453e . Handled = true ;
454+ else
455+ LoadToolTip ( ) ;
441456
442457base . OnToolTipOpening ( e ) ;
443458}