DataGridTemplateColumn for individual control-column vs DataGridTextColumn
what is the difference, both works: DataGridTemplateColumn versus DataGridTextColumn
both works means I can edit+display rich text in the cell.
<DataGridTemplateColumn Header="Homework">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<RichTextBox >
<FlowDocument>
<Paragraph开发者_JS百科>
<Run Text="{Binding Homework}"/>
</Paragraph>
</FlowDocument>
</RichTextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="Homework">
<DataGridTextColumn.CellTemplate>
<DataTemplate>
<RichTextBox >
<FlowDocument>
<Paragraph>
<Run Text="{Binding Homework}"/>
</Paragraph>
</FlowDocument>
</RichTextBox>
</DataTemplate>
</DataGridTextColumn.CellTemplate>
</DataGridTextColumn >
Big difference.
With the Template Column you can put any control inside the DataTemplate, for example a Grid a Button etc. With a Text Column only Text.
精彩评论