私はWPFを持っておりDataGrid
、それはにバインドされていList<Person> people
ます。
public class Person
{
public string Name{get;set;}
public string LastName{get;set;}
public string Address{get;set;}
public int Age{get;set;}
}
public void ShowPeople()
{
myDataGrid.ItemsSource = people;
}
それはすべてうまく表示されますが、Address
私TextBox
はDataGrid
.
XAML コードを次のように変更しました。
<DataGrid x:Name="myDataGrid">
<DataGridTemplateColumn Header="Address">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Path=Address}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid>
これは機能していません。エラーが発生しています。
ItemsSource を使用する前に、Items コレクションを空にする必要があります。
助けてください。ありがとう、