以下のコードではパフォーマンス上の問題があります。 2つのDataGridで2つのリストをバインドしようとしています。各リストのDataGrid。私はバインディングの2つの方法が必要です。なぜ誰が知っていますか?またはsbにアドバイスがありますか?C#WPFデータバインディングDataGrid遅い
これらは、これはこれはDataGrid.Itemsでデータグリッドを更新し、私の分離コード
this.DataGridVertices.ItemsSource = AllVerticesList;
this.DataGridEdges.ItemsSource = AllEdgesList;
I'amあるXAML
<DataGrid x:Name="DataGridVertices" Grid.Row="1" Grid.Column="3" BorderBrush="AliceBlue" BorderThickness="5" AutoGenerateColumns="True" ItemsSource="{Binding AllVerticesList}" />
<DataGrid x:Name="DataGridEdges" Grid.Row="2" Grid.Column="3" BorderBrush="AliceBlue" BorderThickness="5" AutoGenerateColumns="True" ItemsSource="{Binding AllEdgesList}" />
の私のコードで私のクラス
public class Vertices
{
public int ID { get; set; }
public double PositionX { get; set; }
public double PositionY { get; set; }
public string Description { get; set; }
public bool IsMap { get; set; }
public bool IsStartEndPoint { get; set; }
public bool IsDisplay { get; set; }
public bool IsExit { get; set; }
public string TextToSpeech { get; set; }
}
public class Edges
{
public int ID { get; set; }
public int SourceVertex { get; set; }
public int TargetVertex { get; set; }
public bool IsNormal { get; set; }
public bool IsElevatorUp { get; set; }
public bool IsElevatorDown { get; set; }
public bool IsStairUp { get; set; }
public bool IsStairDown { get; set; }
}
です。リフレッシュ();
ありがとうございます!
と、アイテムを適切に仮想化していることを確認してください。https://msdn.microsoft.com/en-us/library/system.windows.controls.datagrid.enablerowvirtualization(v=vs.110).aspx –
完全な追加範囲を持つカスタムObservableCollectionを実装して、新しい要素ごとに1つのイベントではなく、1つのイベントのみを発生させました。 – pix