I want to build a simple properties view where one can change each value.
The properties are grouped by one name like this:
- name1: property1,property2
- name2: property1,property2
- ...
So I created a DataGrid with a template to fill the grid (note that I removed every style property etc. and the text values are also just examples):
<DataGrid>
<DataGrid.Columns>
<DataGridTemplateColumn Header="Property Group Name">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding propertyGroupName}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Property 1">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding property1}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Property 2">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding property2}" TextChanged="TextBox_TextChanged" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
As you can see I'm now trying to add a TextChanged event and there is my problem: Where do I get the propertyGroupName information from, since I only need to change the property2 from a specific propertyGroup.
I'm ready for any hint or solution... maybe the 'auto gen datagrid' isn't the best decision here?
Aucun commentaire:
Enregistrer un commentaire