DataSource for Entity Framework in WPF
LiveLinq / How to use LiveLinq / How to Bind GUI Controls to a Live View
In This Topic
    How to Bind GUI Controls to a Live View
    In This Topic

    LiveLinq views can be used as data sources for GUI controls because they implement the data binding interfaces so you can simply bind any control to it as to any other data source. For example, in WinForms:

    Copy Code
    View<T> view = from a in A.AsLive() join b in B.AsLive() on a.k equals b.k
         where a.p == 5 select new {a, b};
    dataGridView1.DataSource = view;


    Data binding has long been the tool of choice for most developers creating GUI, but its scope was limited to simple cases only. You could bind to your base data, like your base collections, tables of a data set, etc, but not to your derived data, not to data shaped by some query. Some shaping was supported by some tools, but it was very limited, mostly just filtering and sorting. If you had data derived/shaped in any more complex way, for example, with joins (a very common case), you could not use data binding (more exactly, you could only use it for one-time snapshot binding, show data once, no changes allowed).

    LiveLinq makes data binding extremely powerful by removing these limitations. Now you have the full power of LINQ to bind to.

    With live views, you can create entire GUI, sophisticated applications, virtually without procedural code, using declarative data binding alone. An example of such application is the LiveLinqIssueTracker demo|tag=Live views sample application (LiveLinqIssueTracker);document=WordDocuments\LiveLinq-Samples.doc.