zoukankan      html  css  js  c++  java
  • Silverlight 中datagrid控件-- 通过设置数据虚拟化加速显示

    定义依赖属性作为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>

  • 相关阅读:
    第三次作业
    最后一次作业
    第14.15周作业
    第七周作业
    第六周作业
    第四周作业
    第三周作业
    第二周作业
    第一周作业
    第0次作业
  • 原文地址:https://www.cnblogs.com/atuotuo/p/4530372.html
Copyright © 2011-2022 走看看