给定,
<igDP:XamDataGrid Name="dataGrid"
DataSource="{Binding RecordList}">
<igDP:XamDataGrid.FieldLayoutSettings >
<igDP:FieldLayoutSettings AllowAddNew="true" AddNewRecordLocation="OnTopFixed"/>
</igDP:XamDataGrid.FieldLayoutSettings>
运行时,我可以在网格顶部看到一个空的新行。但是新行的列都是不可编辑的!当我将每个字段标记为可编辑时,这些列就是可编辑的。
有没有可能在“不”显式地将每个字段标记为可编辑的情况下使用添加记录功能?
感谢您的关注。
发布于 2011-10-07 16:01:11
你最好的办法就是在infragistics论坛上问这个问题,但我已经说过了…
据我所知,你想要的是一个只读的数据网格(在它的单元格上是不可编辑的),让它有一个可编辑的行来添加新项目...
XamDatagrid.Resources.
CellValuePresenter targetted Style将检查给定的单元格value presenter是否被聚焦并表示添加新行。字段 Name="Key“Visibility="Visible">
附加的行为如下...
public class CellValuePresenterBehavior
{
public static DependencyProperty AllowFieldEditProperty
= DependencyProperty.RegisterAttached(
"AllowFieldEdit",
typeof(bool),
typeof(CellValuePresenterBehavior),
new PropertyMetadata(false, OnAllowFieldEditChanged));
private static void OnAllowFieldEditChanged(
DependencyObject depObj,
DependencyPropertyChangedEventArgs args)
{
var cvp = depObj as CellValuePresenter;
if (cvp != null)
{
cvp.Field.Settings.AllowEdit = (bool)args.NewValue;
}
}
public static bool GetAllowFieldEdit(DependencyObject depObj)
{
return (bool) depObj.GetValue(AllowFieldEditProperty);
}
public static void SetAllowFieldEdit(DependencyObject depObj, bool value)
{
depObj.SetValue(AllowFieldEditProperty, value);
}
}希望这能有所帮助。
https://stackoverflow.com/questions/7682750
复制相似问题