如何在显示其他信息的同时保留更新绑定?

时间:2023-01-27 14:09:51

I'd like to display a linq-to-sql on a datagridview as such:

我想在datagridview上显示linq-to-sql:

 Dim myQ = From b In _dcBooks.Books Select New With {Key b.ID, b.Title, b.Genre, b.ISBN, b.Format, b.Series, _
            .Author =b.BooksAuthors.Count()}

the formula for the authors column is simplified as it would normally display nothing, the only author or "multiple".

作者列的公式被简化,因为它通常不会显示任何内容,唯一的作者或“多个”。

When I add this column the automatic updates that the following query implements don't work:

当我添加此列时,以下查询实现的自动更新不起作用:

Dim myQ=from b in _dcBooks.Books select b

Is it possible to retain the automatic updates/deletes with additional query induced columns like this or is there a simple way to put them in my code?

是否可以使用这样的其他查询引导列保留自动更新/删除,还是有一种简单的方法将它们放入我的代码中?

I can read C# or vb so answers in either is ok by me.

我可以阅读C#或vb,所以我的任何一个答案都可以。

1 个解决方案

#1


I wound up having to wrap everything in an intermediate class that stores the row along with properties that can display or change the row's value when changed. So a custom shim object is needed for every single custom display I guess.

我不得不将所有内容都包装在一个存储行的中间类中,以及可以在更改时显示或更改行值的属性。因此,我想每个自定义显示器都需要一个自定义填充对象。

#1


I wound up having to wrap everything in an intermediate class that stores the row along with properties that can display or change the row's value when changed. So a custom shim object is needed for every single custom display I guess.

我不得不将所有内容都包装在一个存储行的中间类中,以及可以在更改时显示或更改行值的属性。因此,我想每个自定义显示器都需要一个自定义填充对象。