开发者

Is it possible to create a DataGridTemplateColumn that can switch (dynamically) on row level between checkbox and textblock?

Is it possible to create a DataGridColumn that can contain both TextBlock and Checkbox. Let's say for example that I have defined a Datagrid with 7 Columns one of which is a DataGridCheckBoxColumn on the dataGrid and the others have TextBlocks开发者_开发问答. Then when I check the checkbox in a row I want all the cells on that row from TextBlocks to become Checkboxes while the rest rows remain unaffected (I am using VS2008).


You could expose a property on your bound object and link everything accordingly:

Property ---+<---> CheckBoxCol
            |
            +----> TemplateCol >> Trigger ----- TextBlock
                                     |
                                     +--------- CheckBox

So the Checkbox in one column affects said property and the templates of the other columns contain DataTriggers which check is the property is true or false and show the according content.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜