Silverlight Datagrid

This is my first blog on silverlight. Silver datagrid does not support hirarchical data directly. I had a task to create hirarchical datagrid in Silverlight. I have explored many options and during which I came to know about two good features. One is RowDetailsTemplate in Silverlight Datagrid and another is RowGrouping feature. This blog is about RowDetailsTemplate. Generally RowDetailsTemplate is used to display additional information of row. It has many advantages. First it does not affect dimension of rows and cells.Its visibility can be managed on row wise. To create RowDetailsTemplate for row in datagrid we have to set RowDetailsTemplate to as particulartemplate. It can hold any control. Following is an example of RowDetailsTemplate.

<data:datagrid name="datagrid1" row="0" column="0" rowdetailsvisibilitymode="Collapsed">

     <data:datagrid.rowdetailstemplate>

       <datatemplate>

         <data:datagrid name="datagrid2" headersvisibility="None">

         </data:datagrid>

       </datatemplate>

     </data:datagrid.rowdetailstemplate>

</data:datagrid>


As we can see from above code that we can put any control inside RowDetailsTemplate.

Here we have kept another grid inside RowDetailsTemplate.

Control insed row details share same datacontext as of datagrid so we can bound controls inside row details.

With RowDetailsVisibilityMode we can set visibility of row details it has three values.

1) Collpased: Row details are not visible.

2) Visible: Row details are visible.

3) VisibleWhenSelected:When row selected its row details will be visible.

Default value is VisibleWhenSelected. RowDetailsVisibilityChanged event is available when row details visibility changed. With RowDetailsVisibilityMode set to visible when selected, when row gets selectedRowDetailsVisibilityChanged event gets fired. This event also fires for the first row when another row is selected.

Also we can control details visibilty of individual row with DetailsVisibility property of Row.

In short RowDetailsTemplate is an powerful feature of silverlight datagrid. Developer can enhance interactivity and functionality of datagrid with this feature.

I have used this feature to create hirarchical datagrid. If you have any questions or comments plaese let me know.

-By Hiren Dave 

Blog Posts

Rapid Prototyping For Any Device With Foundation

You’ve probably already heard about responsive design, which is website design that responds to... Read more...

30 Beautiful Dark-themed Web Designs for Inspiration

Using a dark color theme in a website can convey many types of feelings and emotions towards its... Read more...

25 Excellent Photoshop Web Design Layout Tutorials

Photoshop is a popular web design tool. With it, you can create web design mock-ups that can later... Read more...
Live Contacts Location Contact Information
  My status 41,Shalin Complex,
Opp Fatehpura Police Station,
Paldi Bhattha
Ahmedabad - 380015
Gujarat, India
+91 (79) 40074674
+91 9898 1717 28
+91 9327 4525 80
info@thedesignshop.co.in
www.thedesignshop.co.in
Bookmark Us
Share |