1 pièce(s) jointe(s)
remplir un datagridview avec une collection
Bonjour,
Je souhaite remplir un datagridview avec une collection en passant par une datasource.
mon problème c'est qu'il n'y a rien qui s'affiche.
Pourtant en debugant, je constate que la datasource est remplie.
Pièce jointe 179450
voici mon code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| dataGridView_command.AutoGenerateColumns = true;
commandBindingSource = new BindingSource();
List<Command> cmds = new List<Command>();
foreach (Command c in FormMain.profile.commandList)
{
cmds.Add(c);
}
commandBindingSource.DataSource = cmds;
dataGridView_command.DataSource = commandBindingSource; |
je ne comprend pas pourquoi rien ne s'affiche.
ma collection command ressemble à ça :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
| namespace Hydra {
[Serializable]
public class Command {
public string commandName;
public string commandString;
public System.Windows.Forms.Keys commandKey;
public System.Windows.Forms.Keys commandKeyModifier;
public bool commandKeyInhibition;
public bool commandKeyPush;
public bool commandKeyRelease;
public string commandKeySeries;
public System.Windows.Forms.MouseButtons commandMouse;
public string commandJoystick;
public string commandJoystickSeries;
public string commandGamepad;
public string commandGamepadSeries;
public string commandDescription;
public string commandCategorie;
public string commandType;
public string commandGroup;
public string commandSubType;
public int commandRepetitions;
public bool commandAutorisationOther;
public bool commandAutorisationForMe;
public List<Actions> actionList;
public Command() {
}
public Command(string commandName,
string commandString,
System.Windows.Forms.Keys commandKey,
System.Windows.Forms.Keys commandKeyModifier,
bool commandKeyInhibition,
bool commandKeyPush,
bool commandKeyRelease,
string commandKeySeries,
System.Windows.Forms.MouseButtons commandMouse,
string commandJoystick,
string commandJoystickSeries,
string commandGamepad,
string commandGamepadSeries,
string commandDescription,
string commandCategorie,
string commandType,
string commandGroup,
string commandSubType,
int commandRepetitions,
bool commandAutorisationOther,
bool commandAutorisationForMe,
List<Actions> actionList)
{
this.commandName = commandName;
this.commandString = commandString;
this.commandKey = commandKey;
this.commandKeyModifier = commandKeyModifier;
this.commandKeyInhibition = commandKeyInhibition;
this.commandKeyPush = commandKeyPush;
this.commandKeyRelease = commandKeyRelease;
this.commandKeySeries = commandKeySeries;
this.commandMouse = commandMouse;
this.commandJoystick = commandJoystick;
this.commandJoystickSeries = commandJoystickSeries;
this.commandGamepad = commandGamepad;
this.commandGamepadSeries = commandGamepadSeries;
this.commandDescription = commandDescription;
this.commandCategorie = commandCategorie;
this.commandType = commandType;
this.commandGroup = commandGroup;
this.commandSubType = commandSubType;
this.commandRepetitions = commandRepetitions;
this.commandAutorisationOther = commandAutorisationOther;
this.commandAutorisationForMe = commandAutorisationForMe;
this.actionList = actionList;
}
public override string ToString() {
string returnString = commandName + " : " + actionList.Count.ToString();
if (actionList.Count > 1) {
returnString += " actions";
}
else {
returnString += " action";
}
return returnString;
} |
merci d'avance pour votre aide