Today's release candidate includes a bunch of feature
additions and tweaks across Silverlight 2, as well as in the VS and Blend tools
targeting it. In general you'll find a number of nice improvements across the
controls, networking, data caching, layout, rendering, media stack, and other
components and sub-systems.
Over the next few months we will be releasing a lot of new
Silverlight 2 controls (more details on these soon). Today's release
candidate includes three new core controls - ComboBox, ProgressBar, and
PasswordBox - that we are adding directly to the core Silverlight runtime
download (which is still only 4.6MB in size, and only takes a few seconds to
install):
Figure 1
At runtime these controls by default look like:
Figure 2
The ComboBox in Silverlight 2 supports standard DropDownList semantics. In addition to statically defining items like
above, you can also use databinding with it. For example, we could define
a "Person" class like below:
Figure 3
And the add a ComboBox to a page like so:
Figure 4
And then write the below code to databind a
collection of Person objects to the ComboBox (by setting its ItemSource
property):
Figure 5
At runtime our simple app will then display the data-bound
Person names (note that we set the DisplayMemberPath property on the ComboBox
above to display the "Name" value from our Person objects):
Figure 6
We could then implement a SelectionChanged event handler
like below to run code when a person is selected from the ComboBox:
Figure 7
Notice above how we can retrieve a reference
to the selected "Person" object from the databound ComboBox using the
ComboBox's "SelectedItem" property.
We can then call the MessageBox.Show() helper
method (new in the RC) to display a modal dialog box that displays some details
about our selected person:
Figure 8