获取由新FrameworkElementFactory(typeof(T))创建的对象

时间:2018-10-18 20:02:11

标签: wpf datagridtemplatecolumn frameworkelementfactory

我们正在将DataGridTemplateColumn添加到DataGrid,并使用

创建的组合框填充DGTC。
socketService.connect().then((socket) => {});
...
new_time.time_list = Array.from(new Array(new_time.max),....);
...
app.controller('AppCtrl', function($scope,$location) {
...

稍后,我们需要更改诸如TextSearch.TextPathProperty之类的属性。
我们从DataGridTemplateColumn获得CellEditingTemplate。问题是,“如何作为组合框访问CellEditingTemplate.VisualTree”?

此代码表明VisualTree是一个组合框:

 DataGridTemplateColumn dgtc = new DataGridTemplateColumn();
 FrameworkElementFactory comboBoxFactory = new FrameworkElementFactory(typeof(ComboBox));  
/* snip */
 DataTemplate cellEditTemplate = new DataTemplate();
 cellEditTemplate.VisualTree = comboBoxFactory;
 dgtc.CellEditingTemplate = cellEditTemplate;

 dgtc.SortMemberPath = string.Format($"{descr.BindingPropertyName}");

 dgtc.Header = descr.BindingPropertyName;

输出:
密钥:类型值:Windows.Controls.ComboBox

似乎无法将VisualTree投射到ComboBox。
我在俯视什么?
谢谢-

0 个答案:

没有答案