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

No comments:

Post a Comment