使XamDataGrid的新行中的特定列不可编辑

时间:2012-08-28 20:01:03

标签: wpf mvvm infragistics xamdatagrid

我正在尝试实现,如问题所示,将一列设置为XamDataGrid中的新行为不可编辑,

<igDP:XamDataGrid.FieldLayouts>
    <igDP:FieldLayout>
        <igDP:Field Name="LOAD_ID" Visibility="Visible">
            <igDP:Field.Settings>
                <igDP:FieldSettings AllowGroupBy="True"
                                    AllowEdit="False"
                                    AllowRecordFiltering="True"
                                    FilterOperatorDefaultValue="Contains" />
            </igDP:Field.Settings>
        </igDP:Field>
        <igDP:Field Name="DESCRIPTION" Visibility="Visible">
            <igDP:Field.Settings>
                <igDP:FieldSettings AllowGroupBy="True"
                                    AllowEdit="True"
                                    AllowRecordFiltering="True"
                                    FilterOperatorDefaultValue="Contains" />
            </igDP:Field.Settings>
        </igDP:Field>
    </igDP:FieldLayout>
</igDP:XamDataGrid.FieldLayouts>

在Load_id的情况下,我已经将allow edit设置为false,但不知何故,这只会影响网格中已经加载的记录,而不是要添加的记录。

<igDP:FieldLayoutSettings
                AllowAddNew="True"
                AddNewRecordLocation="OnBottomFixed" 
                AutoFitMode="Always"
                AutoGenerateFields="False" HighlightAlternateRecords="True" HeaderPrefixAreaDisplayMode="FieldChooserButton" 
                />

它可能是XamDataGrid控件中的一个简单属性,但不知何故我错过了。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:1)

这对我有用

  <ig:UnboundField Label="Filter"  BindingPath="AggregateFilter" BindingMode="TwoWay" >
                            <ig:UnboundField.Settings>
                                <ig:FieldSettings EditorType="{x:Type Editors:XamTextEditor}">
                                <ig:FieldSettings.EditorStyle>
                                    <Style TargetType="{x:Type Editors:XamTextEditor}">
                                            <Setter Property="IsReadOnly" Value="{Binding Path=DataContext.isCusipMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ig:XamDataGrid}}}"/>
                                    </Style>
                                </ig:FieldSettings.EditorStyle>
                            </ig:FieldSettings>
                            </ig:UnboundField.Settings>
                        </ig:UnboundField>