Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit200e32f

Browse files
committed
#101 Optimised the tooltip... loaded only when needed
I little bug need to be corrected in tooltip visual
1 parent14ba6fe commit200e32f

File tree

1 file changed

+35
-20
lines changed

1 file changed

+35
-20
lines changed

‎Sources/WPFHexaEditor/BaseByte.cs‎

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ abstract class BaseByte : FrameworkElement, IByteControl
3232
privateByteAction_action=ByteAction.Nothing;
3333
privateIByte_byte;
3434
privatebool_isHighLight;
35+
privatebool_tooltipLoaded;
3536
#endregion global class variables
3637

3738
#region Events
@@ -66,26 +67,7 @@ protected BaseByte(HexEditor parent)
6667
//Parent hexeditor
6768
_parent=parent??thrownewArgumentNullException(nameof(parent));
6869

69-
#region Binding tooltip
70-
71-
LoadDictionary("/WPFHexaEditor;component/Resources/Dictionary/ToolTipDictionary.xaml");
72-
vartxtBinding=newBinding
73-
{
74-
Source=FindResource("ByteToolTip"),
75-
UpdateSourceTrigger=UpdateSourceTrigger.PropertyChanged,
76-
Mode=BindingMode.OneWay
77-
};
78-
79-
// Load ressources dictionnary
80-
voidLoadDictionary(stringurl)
81-
{
82-
varttRes=newResourceDictionary{Source=newUri(url,UriKind.Relative)};
83-
Resources.MergedDictionaries.Add(ttRes);
84-
}
85-
86-
SetBinding(ToolTipProperty,txtBinding);
87-
88-
#endregion
70+
ToolTip=".";
8971

9072
//Default properties
9173
DataContext=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+
internalvoidLoadToolTip()
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+
voidLoadDictionary(stringurl)
345+
{
346+
varttRes=newResourceDictionary{Source=newUri(url,UriKind.Relative)};
347+
Resources.MergedDictionaries.Add(ttRes);
348+
}
349+
350+
SetBinding(ToolTipProperty,newBinding
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
{
439452
if(Byte==null||!_parent.ShowByteToolTip)
440453
e.Handled=true;
454+
else
455+
LoadToolTip();
441456

442457
base.OnToolTipOpening(e);
443458
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp