how to fire a dynamically generated button in datagrid using mvvm ,

Jun 1 2012 8:33 AM
how to fire a button which was generated dynamically in datagrid by using mvvm patarn and galasoft dll,

eg:  I have a grid with displaying firstname , last name , and in each row having delete, edit button which are generating dynamically ,by clicking on selected row , row has to be delete or Edit how can achive this if i click on edit button a child window has to pop up , i used galasoft dll  and i:interaction triggers , observable collection and MVVM patern please help me .


the bellow is my .xaml code

<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<GalaSoft_MvvmLight_Command:EventToCommand Command="{Binding SelectionChangedRelayCommand}"
CommandParameter="{Binding SelectedItem, ElementName=DisplayGrid}"/>
</i:EventTrigger>
</i:Interaction.Triggers>

Viewmodelcode to select the row


public RelayCommand<object> SelectionChangedRelayCommand
{
get;
set;
}
public void SelectionChangedCommandExecute(object param)
{
this._StudentDtos = param as StudentDto
EDITCmd.RaiseCanExecuteChanged();

DeleteAllCmd.RaiseCanExecuteChanged();

}