开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜