This repository was archived by the owner on Oct 16, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormsDesigner Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -297,9 +297,9 @@ string GenerateField(CodeMemberField newField)
297297
298298 void CreateField ( CodeMemberField newField )
299299 {
300- // insert new field below InitializeComponents()
301-
302- var bodyRegion = initializeComponents . BodyRegion ;
300+ // insert new field below the last field or InitializeComponents()
301+ var field = FormsDesignerSecondaryDisplayBinding . GetLastField ( formClass , initializeComponents . BodyRegion . FileName ) ;
302+ var bodyRegion = field != null ? field . BodyRegion : initializeComponents . BodyRegion ;
303303 DocumentScript script = GetScript ( bodyRegion . FileName ) ;
304304 string newline = DocumentUtilities . GetLineTerminator ( script . OriginalDocument , bodyRegion . BeginLine ) ;
305305 string indentation = DocumentUtilities . GetIndentation ( script . OriginalDocument , bodyRegion . BeginLine ) ;
Original file line number Diff line number Diff line change @@ -55,6 +55,13 @@ public static IMethod GetInitializeComponents(ITypeDefinition c)
5555 }
5656 return null ;
5757 }
58+
59+ public static IField GetLastField ( ITypeDefinition c , string fileNmae )
60+ {
61+ if ( c == null )
62+ return null ;
63+ return c . Fields . LastOrDefault ( field => field . BodyRegion . FileName == fileNmae ) ;
64+ }
5865
5966 public static bool BaseClassIsFormOrControl ( ITypeDefinition c )
6067 {
You can’t perform that action at this time.
0 commit comments