views:

152

answers:

1

Hello,

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>
                                    <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 >
A: 

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.

elsharpo