Download MASTER THESIS
Transcript
generic type parameter type of the collection as discussed in section 2.7.3). The following
listing shows how columns are created dynamically and prepared to be bound to
ObjectValues .
foreach (var member in itemTypeMembers)
{
var memberColumn = new GridViewColumn();
memberColumn.Header = member.Name;
// "{Binding Path=[Name].Value}"
memberColumn.DisplayMemberBinding=new Binding("["+member.Name+"].Value");
gridView.Columns.Add(memberColumn);
}
Listing 30 – Data binding of ObjectValues to GridView columns
Note on generic data virtualization
Note that in our case, the only way to get a set of items from the debugger is to query items
one by one. However, there are scenarios where querying a range of items at once is faster
than obtaining items one by one (for example relational databases). In such scenario it is
reasonable to implement paging mechanism in the concrete value provider so that when the
provider is asked for an item at position i it queries and caches a number of items around
index i (because it is very likely that these items will be needed soon).
3.3.2 Expanding rows of the grid
Sometimes also the values shown in individual grid cells are complex objects. The values in
grid cells are obtained by invoking the standard ToString() method which only returns the
name of the type (when not overridden) which is not a desirable way of presenting complex
objects.
Figure 40 – The values of property Badge are complex objects.
Thanks to the design of general handling of collections described in section 2.5 (Collections), it
is possible to implement expanding of individual rows in the following way: display an expand
button next to each grid row and when it is clicked, open a Debugger tooltip for expression
70