WEB开发网
开发学院图形图像Flash Using The Silverlight DataGrid 阅读

Using The Silverlight DataGrid

 2008-10-24 11:47:00 来源:WEB开发网   
核心提示: Step 3: Simple Customization of the DataGridThe easiest way to customize the DataGrid is through a variety of properties.The other two ways are

Using The Silverlight DataGrid

Step 3: Simple Customization of the DataGrid

The easiest way to customize the DataGrid is through a variety of properties. The other two ways are through Styles and Templates which will be covered in future posts. Some of the most useful properties for customization are:

GridLinesVisibility & HeadersVisibility

These properties are enumerations that control what gridlines and headers are displayed.

RowBackground & AlternatingRowBackground

These properties are shortcuts to setting the background color for both rows and alternating rows.

ColumnWidth & RowHeight

These properties set the default column width and default row height.

IsReadOnly & CanUserResizeColumns

These properties control if the end user can edit the data in the grid and if the columns can be resized.

For instance if you set the following properties to the following values:

<data:DataGrid x:Name="dg" AutoGenerateColumns="True"
  GridlinesVisibility="None" HeadersVisibility="All"
  RowBackground="Cornsilk" AlternatingRowBackground="LemonChiffon"
  ColumnWidth="85" RowHeight="30"
  IsReadOnly="True" CanUserResizeColumns="False"
  >
</data:DataGrid>

You would get this:

Using The Silverlight DataGrid

Step 4: Enjoy

Now that you have the basics, enjoy using the DataGrid. Next time I'll go into how to explicitly define and customize columns instead of using auto generation.

上一页  1 2 3 4 5 6 

Tags:Using The Silverlight

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接