开发者

DataGridTemplateColumn for individual control-column vs DataGridTextColumn

开发者 https://www.devze.com 2022-12-22 12:40 出处:网络
what is the difference, both works: DataGridTemplateColumn versus DataGridTextColumn both works means I can edit+display rich text in the cell.

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

精彩评论

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