标签:
定义依赖属性作为datagrid的数据源
protected static readonly DependencyProperty ViewLogsProperty =
DependencyProperty.Register("ViewLogs", typeof(ObservableCollection<RMSReportEvent>), typeof(LogViewer), new PropertyMetadata(null));
protected ObservableCollection<RMSReportEvent> ViewLogs
{
get { return (ObservableCollection<RMSReportEvent>)GetValue(ViewLogsProperty); }
set { SetValue(ViewLogsProperty, value); }
}
页面进行绑定的同时,设置数据虚拟化
<data:DataGrid AutoGenerateColumns="False" AlternatingRowBackground="White" RowBackground="White"
RowHeight="26" GridLinesVisibility="All" BorderThickness="0" ItemsSource="{TemplateBinding ViewLogs}"
Margin="1" VirtualizingStackPanel.VirtualizationMode="Recycling">
<data:DataGrid.Columns>
......
</data:DataGrid.Columns>
</data:DataGrid>
Silverlight 中datagrid控件-- 通过设置数据虚拟化加速显示
标签:
原文地址:http://www.cnblogs.com/atuotuo/p/4530372.html