WPF DataGrid와 관련하여 질문이 있습니다. IDataErrorInfo 유효성 검사를 위해 모든 선택된 행을 편집으로 설정하고 싶습니다. 즉, 모든 셀의 셀 템플릿을 CellTemplate에서 CellEditingTemplate으로 설정한다는 의미입니다.전체 선택된 DataGrid 행 템플릿을 CellEditingTemplate으로 설정하십시오.
<DataGridTemplateColumn Header="Note">
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<TextBox Name="textBoxNote" Text="{Binding Note, ValidatesOnDataErrors=True}" />
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Note}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
는 XAML (일종의 트리거)의 가능성이있다 :
이것은 예를 들어 한 열이인가? 코드 숨김에서 어떻게 할 수 있습니까? 두 개의 개별 스타일을 리소스로 사용하여 솔루션을 찾은 다음 Row_Selected 및 Row_Unselected 이벤트에서 프로그래밍 방식으로 전환 할 수 있지만 별도의 CellTemplate 및 CellEditingTemplate이있는 열에 XAML 코드를 사용하는 것이 좋습니다.
누구나 올바른 방법을 가르쳐 줄 수 있습니까?
미리 감사드립니다. 감사합니다. DB