首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Ingragistic XamGrid:新记录不可编辑

Ingragistic XamGrid:新记录不可编辑
EN

Stack Overflow用户
提问于 2011-10-07 11:25:25
回答 1查看 3.1K关注 0票数 0

给定,

代码语言:javascript
复制
    <igDP:XamDataGrid Name="dataGrid" 
                          DataSource="{Binding RecordList}">
            <igDP:XamDataGrid.FieldLayoutSettings >
                <igDP:FieldLayoutSettings AllowAddNew="true" AddNewRecordLocation="OnTopFixed"/>
            </igDP:XamDataGrid.FieldLayoutSettings>

运行时,我可以在网格顶部看到一个空的新行。但是新行的列都是不可编辑的!当我将每个字段标记为可编辑时,这些列就是可编辑的。

有没有可能在“不”显式地将每个字段标记为可编辑的情况下使用添加记录功能?

感谢您的关注。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-10-07 16:01:11

你最好的办法就是在infragistics论坛上问这个问题,但我已经说过了…

据我所知,你想要的是一个只读的数据网格(在它的单元格上是不可编辑的),让它有一个可编辑的行来添加新项目...

XamDatagrid.Resources.

  • This下的
  1. Add a CellValuePresenter targetted Style将检查给定的单元格value presenter是否被聚焦并表示添加新行。
  2. 如果是这样,它将通过某些附加行为使父字段可编辑。

字段 Name="Key“Visibility="Visible">

附加的行为如下...

代码语言:javascript
复制
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);
    }
}

希望这能有所帮助。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7682750

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档