Infragistics XamDataGrid AllowEdit 属性绑定不起作用

发布于 2024-12-29 06:41:15 字数 287 浏览 1 评论 0原文

在我的 XAML 中,我尝试将 XamDataGrid 的 AllowEdit 绑定到属性,

<igDP:XamDataGrid.FieldSettings>
  <igDP:FieldSettings AllowEdit="{Binding Path=DataItem.Approved}"/>
</igDP:XamDataGrid.FieldSettings>

但它不起作用。所有其他绑定都工作正常。有什么想法吗?我是 WPF 新手,因此我们将不胜感激

In my XAML I'm trying to bind AllowEdit of my XamDataGrid to a property

<igDP:XamDataGrid.FieldSettings>
  <igDP:FieldSettings AllowEdit="{Binding Path=DataItem.Approved}"/>
</igDP:XamDataGrid.FieldSettings>

But it doesn't work. All other bindings work fine. Any ideas? I'm new to WPF so any help would be appreciated

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

枉心 2025-01-05 06:41:15

我使用一种样式来解决这个限制,例如:

<igWPF:Field Name="SomeValue">
    <igWPF:Field.Settings>
    <igWPF:FieldSettings EditorType="{x:Type igWPF:XamNumericEditor}">
        <igWPF:FieldSettings.EditorStyle>
        <Style TargetType="{x:Type igWPF:XamNumericEditor}">
            <Setter Property="IsReadOnly" Value="{Binding DataItem.IsReadOnly}" />
        </Style>
        </igWPF:FieldSettings.EditorStyle>
    </igWPF:FieldSettings>
    </igWPF:Field.Settings>
</igWPF:Field>

I use a style to get around this limitation, e.g.:

<igWPF:Field Name="SomeValue">
    <igWPF:Field.Settings>
    <igWPF:FieldSettings EditorType="{x:Type igWPF:XamNumericEditor}">
        <igWPF:FieldSettings.EditorStyle>
        <Style TargetType="{x:Type igWPF:XamNumericEditor}">
            <Setter Property="IsReadOnly" Value="{Binding DataItem.IsReadOnly}" />
        </Style>
        </igWPF:FieldSettings.EditorStyle>
    </igWPF:FieldSettings>
    </igWPF:Field.Settings>
</igWPF:Field>
岁月静好 2025-01-05 06:41:15

我通常使用一种风格来实现这一点,如上面 @larsmona 的回答所示。最近我了解了如何使用 CellBindings 和 FieldBindings 来实现此目的。

https://www.infragistics.com/community/blogs/b/blagunas/posts/feature-spotlight-new-fetaures-in-the-infragistics-wpf-xamdatagrid

https://www.infragistics.com/help/wpf/xamdatagrid-binding-cell-settings-data-item-properties

http://help.infragistics.com/Help/Doc/WPF/2014.2/CLR4.0/html/xamDataPresenter_Binding_Cell_Settings_Data_Item_Properties.html

<igDP:Field Name="SomeName" Row="0" Column="1" Label="SomeLabel" AllowEdit="True">
  <igDP:Field.CellBindings>
   <igDP:CellBinding Target="Editor" Property="IsReadOnly" Binding="{Binding DataItem.SomeProperty}"></igDP:CellBinding>
  </igDP:Field.CellBindings>
</igDP:Field>

I usually used a style to achieve this as in @larsmona's answer above. Recently I learned about using CellBindings and FieldBindings to achieve this.

https://www.infragistics.com/community/blogs/b/blagunas/posts/feature-spotlight-new-fetaures-in-the-infragistics-wpf-xamdatagrid

https://www.infragistics.com/help/wpf/xamdatagrid-binding-cell-settings-data-item-properties

http://help.infragistics.com/Help/Doc/WPF/2014.2/CLR4.0/html/xamDataPresenter_Binding_Cell_Settings_Data_Item_Properties.html

<igDP:Field Name="SomeName" Row="0" Column="1" Label="SomeLabel" AllowEdit="True">
  <igDP:Field.CellBindings>
   <igDP:CellBinding Target="Editor" Property="IsReadOnly" Binding="{Binding DataItem.SomeProperty}"></igDP:CellBinding>
  </igDP:Field.CellBindings>
</igDP:Field>
笔落惊风雨 2025-01-05 06:41:15

显然你(仍然......)无法绑定此属性: http:// www.infragistics.com/community/forums/t/10907.aspx
叹...

Apparently you (still.....) cannot bind this property: http://www.infragistics.com/community/forums/t/10907.aspx
sigh...

拒绝两难 2025-01-05 06:41:15

也许您正在绑定到 ObservableCollection?如果是这种情况,您将无法编辑您的项目。您可以尝试绑定到 BindingList

Perhaps you're binding to ObservableCollection? If that's the case, you can't edit your items. You can try bind to BindingList instead.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文