[英]Should I use a single DataGrid, multiple DataGrids or something entirely different?
我有一個稱為“人”的對象集合,每個對象都包含“名稱”,“ ID”和“時間”字符串。 這些人員必須顯示在固定數目的行和9列的網格上。 想法是將人員作為行添加到第1、2和3列的網格左側。一旦填充了最后一行,則將下一行添加到第4、5和7列組的“頂部”。 6以“包裝”效果。 在完成分組填充后,將使用最后一組7、8和9。
我試圖決定是使用單個DataGrid來執行此操作,還是使用三個單獨的DataGrid。 數據將每隔幾秒鍾更新一次,因此性能是一個問題。 但是,我主要關心的是哪種方法更容易實現和更清潔。 是否存在具有此“包裝”功能的第三方網格控件?
這是使用WPF的C#應用程序。
謝謝。
我根本不會使用任何類型的DataGrid,而不會使用帶有WrapPanel內容演示者和定義良好的ItemsTemplate的ListView。
這是一個入門的示例樣式:
<Style TargetType="{x:Type ListView}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<ScrollViewer Margin="{TemplateBinding Padding}">
<WrapPanel ItemWidth="150" IsItemsHost="True" MinWidth="100"
Width="{Binding ActualWidth,RelativeSource={RelativeSource AncestorType=ScrollContentPresenter}}">
</WrapPanel>
</ScrollViewer>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.