ComponentOne PropertyGrid™ for Silverlight is a Silverlight version of the popular PropertyGrid control that ships as part of the .NET WinForms platform. Using ComponentOne PropertyGrid™ for Silverlight, users can browse and edit properties on any .NET object. The C1PropertyGrid control is part of the C1.Silverlight.Extended assembly.
Introduction to the C1PropertyGrid Control
Like the original PropertyGrid control, the C1PropertyGrid control works based on a SelectedObject property.
Once this property is set, the control displays the object’s public properties and allows the user to edit them.
For example, assuming you have a simple Customer class defined as follows:
public class Customer
{
public string Name { get; set; }
public string EMail { get; set; }
public string Address { get; set; }
public DateTime CustomerSince { get; set; }
public bool SendNewsletter { get; set; }
public int? PointBalance { get; set; }
}
You could build a user interface to display and edit customers using the following code:
public Page()
{
InitializeComponent();
// Create object to browse
var customer = new Customer();
// Create C1PropertyGrid
var pg = new C1PropertyGrid();
LayoutRoot.Children.Add(pg);
// Show customer properties
pg.SelectedObject = customer;
}
2 · Introduction to the C1PropertyGrid Control
And the resulting application would look like this:
This simple UI allows users to edit all the properties in our Customer objects. It was built automatically based on the object’s properties and will be automatically updated if you add or modify the properties in the Customer class. Note that the C1PropertyGrid only displays properties of value type and strings. It does not display properties that contain objects with other properties.
Notice that properties are shown in alphabetical order by default. You can change this by setting the SortProperties property to False
Download pdf PropertyGrid for Silverlight
Related Searches: customer class, public string, class customer, string name, public int
RSS feed for comments on this post · TrackBack URI
Leave a reply