【发布时间】:2015-04-22 13:09:20
【问题描述】:
如何在infragistics xamdatagrid中找到基于ActiveRecord或ActiveCell的cellvaluepresenter?
我尝试了下面的代码,但它在单元格值呈现器中给出了 null。
private void grdGrid_RecordActivated(object sender,RecordActivatedEventArgs e)
{
(grdGrid.ActiveRecord as DataRecord).Cells["fldDescription"].IsActive = true;
Cell selectedCell = grdGrid.ActiveCell;
CellValuePresenter cvp = CellValuePresenter.FromCell(selectedCell);
cvp.Editor.StartEditMode();
}
这是绑定
<igDP:UnboundField Name="fldDescription" Label="Description" BindingPath="TaskItemAction.Description" BindingMode="TwoWay">
<igDP:Field.Settings>
<igDP:FieldSettings CellClickAction="EnterEditModeIfAllowed" EditorStyle="{StaticResource textStyleKey}" EditorType="{x:Type editors:XamTextEditor}" EditAsType="{x:Type sys:String}"
CellWidth="30" CellHeight="30" AllowEdit="True" Width="0.4*" Height="30" >
</igDP:FieldSettings>
</igDP:Field.Settings>
所以现在我想通过该事件找到已激活的记录并找到编辑器类型并启动编辑模式。
private void GrdTaskItemAction_RecordActivated(object sender, RecordActivatedEventArgs e)
{
grdGrid.ExecuteCommand(DataPresenterCommands.StartEditMode);
}
对我来说工作正常,但它正在为单元格而不是编辑器(其中的控件)调用编辑模式。
我想在激活的单元格中找到那个编辑器并使其开始可编辑类型。
【问题讨论】:
标签: wpf wpf-controls infragistics xamdatagrid