简体   繁体   English

如何获取DataGridTextColumn的默认ControlTemplate?

[英]How can I get the default ControlTemplate of DataGridTextColumn?

I wanna custom the ControlTemplate of DataGridTextColumn. 我想自定义DataGridTextColumn的ControlTemplate。 I always get the default ControlTemplate via this: 我总是通过以下方式获取默认的ControlTemplate:
1. Right-click the control. 1.右键单击该控件。
2. Edit Template. 2.编辑模板。
3. Edit a copy. 3.编辑副本。

Just as the image shows below: 如下图所示: 在此处输入图片说明

However, I can see the DataGridTextColumn in the designer so that I can't right click it. 但是,我可以在设计器中看到DataGridTextColumn,因此无法右键单击它。

So how can I get the default ControlTemplate of it? 那么如何获得它的默认ControlTemplate? Please help me. 请帮我。 Thank you. 谢谢。

A DataGridTextColumn is not a Control and has no ControlTemplate . DataGridTextColumn不是Control ,并且没有ControlTemplate

It generates a TextBlock in its GenerateElement method and a TextBox in its GenerateEditingElement method. 它在其GenerateElement方法中生成一个TextBlock ,并在其GenerateEditingElement方法中GenerateEditingElement一个TextBox You'll find the source code here . 您可以在此处找到源代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将自定义控件模板设置为整个应用程序的默认值? - How can I set a custom Controltemplate as the default for whole application? 如何使用DatagridTextColumn.ElementStyle使DatagridTextColumn变为只读? - How can i use DatagridTextColumn.ElementStyle to Make DatagridTextColumn readonly? 如何在代码中设置DataGridTextColumn的绑定? - How can I set the binding of a DataGridTextColumn in code? 我怎么有一个ControlTemplate只能为控件的默认,未更改的可视树创建一个容器? - How can I have a ControlTemplate that only creates a container for the default, unaltered visual tree of a control? 如何在ControlTemplate中绑定? - How can I bind inside this ControlTemplate? 如何将ControlTemplate用于许多网格? - How can I use ControlTemplate for many grids? 我如何更改ControlTemplate的最后一个属性 - How can i Changes in the last property of the ControlTemplate 如何在ControlTemplate中绑定RadioButton - How can I bind a RadioButton in a ControlTemplate 如何将任何 DataGridTextColumn 传递给将切换 DataGridTextColumn 的可见性的单个命令? - How can I pass any DataGridTextColumn to a single Command which will toggle the Visibility of the DataGridTextColumn? 如何在DataGridTextColumn的右侧对齐内容 - How Can I Align my Content in Right side of DataGridTextColumn
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM