From 2004b99083e8e6e72b815c805e84900aa4e699e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Wagenf=C3=BChr?= Date: Tue, 20 Aug 2019 13:04:09 +0200 Subject: [PATCH] Fix loading of the Resource-Dictionary for "AutoCompleteManager" Previously the Resource-Dictionary was every single time the "AutoCompleteManager" was initialized, because the "FindName" Method of a ResourceDictionary was used. According to Microsoft's Documentation: https://docs.microsoft.com/de-de/dotnet/api/system.windows.resourcedictionary.findname?view=netframework-4.8 This Method always returns null, because Keys are used in a Dictionary. That's why this piece of code was faulty. --- NZazu/Fields/Libs/AutoCompleteManager.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/NZazu/Fields/Libs/AutoCompleteManager.cs b/NZazu/Fields/Libs/AutoCompleteManager.cs index 52ecf12..ad18d81 100644 --- a/NZazu/Fields/Libs/AutoCompleteManager.cs +++ b/NZazu/Fields/Libs/AutoCompleteManager.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; @@ -99,7 +99,7 @@ public void AttachTextBox(TextBox textBox) if (Application.Current == null) return; // because we are in testing - if (Application.Current.Resources.FindName("AcTb_ListBoxStyle") == null) + if (!Application.Current.Resources.Contains("AcTb_ListBoxStyle")) { var myResourceDictionary = new ResourceDictionary(); // TODO: hard coded namespace. this can break on namespace changes! avoid that! @@ -702,4 +702,4 @@ private void UpdateText(string text, bool selectAll) #endregion } -} \ No newline at end of file +}