Showing posts with label Silverlight. Show all posts
Showing posts with label Silverlight. Show all posts

Tuesday, April 22, 2008

DataGrid revisited

Today I held a little presentation at work showing off some of the DataGrid capabilities in Silverlight 2.0 beta. It's basically based upon my last post, but I added some new functionality that shows use of the DataGridCheckBoxColumn and the DataGridTemplateColumn.
<Data:DataGridCheckBoxColumn Header="Is done" DisplayMemberBinding="{Binding IsDone, Mode=TwoWay}" />
<Data:DataGridTemplateColumn Header="Due date">
  <Data:DataGridTemplateColumn.CellTemplate>
      <DataTemplate>
          <TextBlock Text="{Binding DueDate, Mode=TwoWay}" />
      </DataTemplate>
  </Data:DataGridTemplateColumn.CellTemplate>
  <Data:DataGridTemplateColumn.CellEditingTemplate>
      <DataTemplate>
          <DatePicker SelectedDateFormat="Short" FirstDayOfWeek="Monday" SelectedDate="{Binding DueDate, Mode=TwoWay}" />
      </DataTemplate>
  </Data:DataGridTemplateColumn.CellEditingTemplate>
</Data:DataGridTemplateColumn>
You can download the source code here

Sunday, March 30, 2008

Silverlight 2.0: Two-way data binding with DataGrid

I've written a little Master/Detail demo application using the DataGrid control in Silverlight 2.0 beta 1. The application shows usage of data binding, styles and definition of custom columns for the DataGrid control. You can download the source code here.




The following code fragment shows how to define your own columns for the data grid: