For example i got a class person:
class Person {
string Name { get; set; }
}
In my mainWindow of my wpf application i got a ObservableCollection with this class and i want to display this in a table.
I get it working to display the members(only Name in this case) in a table, but for some reasons i got a button in the table. In this button i use the ‘command’ property in the xaml file to bind an ICommand to it.
Thats what i got working sofar but how can i send the object ‘Person’ itself as parameter to the command? i used the commandparameter in the xaml succesfully for string / int but how can i send the object i’m displaying in the row?
Thnx!
Sounds like you’re not binding the object correctly in the CommandParameter value. I needs to be a public property either in the codebehind or in your ViewModel (if you’re using MVVM) and if this value changes it will need to utilize the PropertyChanged event.
Hope this makes sense.