File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
src/System.Windows.Forms/src/System/Windows/Forms/Controls/ToolStrips Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -196,6 +196,12 @@ protected override AccessibleObject CreateAccessibilityInstance()
196196
197197 private void Initialize ( )
198198 {
199+ if ( Control . UseComponentModelRegisteredTypes )
200+ {
201+ // Register the type with the ComponentModel so as to be trim safe
202+ TypeDescriptor . RegisterType < Keys > ( ) ;
203+ }
204+
199205 Overflow = ToolStripItemOverflow . Never ;
200206 MouseDownAndUpMustBeInSameItem = false ;
201207 SupportsDisabledHotTracking = true ;
@@ -1114,8 +1120,7 @@ internal void SetNativeTargetWindow(IWin32Window window)
11141120 }
11151121 else
11161122 {
1117- // Call the trim safe API
1118- TypeDescriptor . RegisterType < Keys > ( ) ;
1123+ // Call the trim safe API, Keys type has been registered at Initialize()
11191124 return TypeDescriptor . GetConverterFromRegisteredType ( typeof ( Keys ) ) . ConvertToString ( context : null , CultureInfo . CurrentUICulture , shortcutKeys ) ;
11201125 }
11211126 }
You can’t perform that action at this time.
0 commit comments