I have property ObservableCollection
in my ViewModel
and in View
I want to charge that property throw the DataGrid. I want to do that with button. Can anybody Help me? My property has Name and Value and both of them are strings.
public ObservableCollection<Parameter> EnviromentVariables
{
get;
}
XAML code:
<GroupBox Header="Enviroment Variables" Width="250" Margin="10" VerticalAlignment="Top">
<DataGrid ItemsSource="{Binding EnviromentVariables}" CanUserAddRows="True" Height="150" IsReadOnly="False" Margin="10">
<DataGrid.Columns>
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="+" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</GroupBox>