According to my other question:
I got a list and a selected index which I serialize:
public interface IControlListManager
{
List<ControlListManager.TargetSettings> TargetList { get; set; }
int SelectedIndex { get; set; }
}
Inside designer.cs I got the following serialized code:
//...
controlListManager1.SelectedIndex = 0;
controlListManager1.TargetList.Add(new ControlListManager.TargetSettings(this, "", DisplayModes.FollowXY, true, 0, 0, 0));
controlListManager1.TargetList.Add(new ControlListManager.TargetSettings(this.InfoPanel, "", DisplayModes.FollowXY, true, 0, 0, 0));
controlListManager1.TargetList.Add(new ControlListManager.TargetSettings(this.InfoText, "", DisplayModes.FollowXY, true, 0, 0, 0));
controlListManager1.TargetList.Add(new ControlListManager.TargetSettings(this.HLine, "", DisplayModes.FollowXY, true, 0, 0, 0));
controlListManager1.TargetList.Add(new ControlListManager.TargetSettings(this.LogiDevType, "", DisplayModes.FollowXY, true, 0, 0, 0));
controlListManager1.TargetList.Add(new ControlListManager.TargetSettings(this.LogiDevSetBtn, "", DisplayModes.FollowXY, true, 0, 0, 0));
controlListManager1.TargetList.Add(new ControlListManager.TargetSettings(this.SystrayContextMenu, "", DisplayModes.FollowXY, true, 0, 0, 0));
controlListManager1.TargetList.Add(new ControlListManager.TargetSettings(this.restoreToolStripMenuItem, "", DisplayModes.FollowXY, true, 0, 0, 0));
controlListManager1.TargetList.Add(new ControlListManager.TargetSettings(this.exitToolStripMenuItem, "", DisplayModes.FollowXY, true, 0, 0, 0));
controlListManager1.TargetList.Add(new ControlListManager.TargetSettings(this.panel1, "", DisplayModes.FollowXY, true, 0, 0, 0));
controlListManager1.TargetList.Add(new ControlListManager.TargetSettings(this.IdentifierInput, "", DisplayModes.FollowXY, true, 0, 0, 0));
controlListManager1.TargetList.Add(new ControlListManager.TargetSettings(this.ExitButton, "", DisplayModes.FollowXY, true, 0, 0, 0));
controlListManager1.TargetList.Add(new ControlListManager.TargetSettings(this.IdentifierCheckbox, "", DisplayModes.FollowXY, true, 0, 0, 0));
controlListManager1.TargetList.Add(new ControlListManager.TargetSettings(this.SaveLogFile, "", DisplayModes.FollowXY, true, 0, 0, 0));
//...
The problem is that SelectedIndex
should be after the list because well it represents the index of the list.
How can I tell the designer to put it after the list?
CodePudding user response:
Because I don't want to mess around with BeginInit() and EndInit() methods (what I really should) and found out, that it's really fact, that the serializer order is alphabetical.
I renamed SelectedIndex
to ZSelectedIndex
. Funny and dirty - but quick solution.