11using System ;
22using System . Collections . Generic ;
33using System . ComponentModel ;
4+ using System . Diagnostics ;
45using System . Globalization ;
56using System . Windows . Input ;
67using System . Linq ;
@@ -1428,7 +1429,36 @@ public bool ShouldIgnoreHotkeys()
14281429 #endregion
14291430
14301431 #region Public Methods
1432+ public void ClearAllCacheModes ( DependencyObject element )
1433+ {
1434+ if ( element == null )
1435+ return ;
14311436
1437+ // 현재 요소의 CacheMode를 확인하고 제거
1438+ if ( element is UIElement uiElement && uiElement . CacheMode != null )
1439+ {
1440+ string elementName = GetElementName ( uiElement ) ;
1441+ Debug . WriteLine ( $ "CacheMode 제거: { elementName } - CacheMode 타입: { uiElement . CacheMode . GetType ( ) . Name } ") ;
1442+ uiElement . CacheMode = null ;
1443+ }
1444+
1445+ // 모든 자식 요소에 대해 재귀적으로 CacheMode 제거
1446+ int childCount = VisualTreeHelper . GetChildrenCount ( element ) ;
1447+ for ( int i = 0 ; i < childCount ; i ++ )
1448+ {
1449+ DependencyObject child = VisualTreeHelper . GetChild ( element , i ) ;
1450+ ClearAllCacheModes ( child ) ;
1451+ }
1452+ }
1453+ private string GetElementName ( UIElement element )
1454+ {
1455+ // 요소의 이름 가져오기 시도
1456+ if ( element is FrameworkElement fe && ! string . IsNullOrEmpty ( fe . Name ) )
1457+ return fe . Name ;
1458+
1459+ // 이름이 없으면 타입 반환
1460+ return element . GetType ( ) . Name ;
1461+ }
14321462 public void Show ( )
14331463 {
14341464 Application . Current . Dispatcher . Invoke ( ( ) =>
@@ -1442,6 +1472,7 @@ public void Show()
14421472 mainWindow . ClockPanel . Visibility = Visibility . Visible ;
14431473 //mainWindow.SearchIcon.Visibility = Visibility.Visible;
14441474 SearchIconVisibility = Visibility . Visible ;
1475+ ClearAllCacheModes ( mainWindow ) ;
14451476 }
14461477
14471478 // Update WPF properties
@@ -1454,8 +1485,11 @@ public void Show()
14541485 {
14551486 Win32Helper . SwitchToEnglishKeyboardLayout ( true ) ;
14561487 }
1488+
14571489 } ) ;
14581490 }
1491+
1492+
14591493
14601494#pragma warning disable VSTHRD100 // Avoid async void methods
14611495
0 commit comments