Answer the question
In order to leave comments, you need to log in
How to update DataGrid.ItemsSource without freezes (C# WPF .NET 4.5)?
Greetings to all, alas, attempts to find 'bicycles' in Google ended to no avail.
The problem is this:
I have
public static DataTable DataTableAccounts { get; set; }
Which I get from the database. DataGridAccounts.ItemsSource = DataTableAccounts.DefaultView;
DataGridAccounts.ItemsSource = null;
DataGridAccounts.ItemsSource = DataTableAccounts.DefaultView;
Answer the question
In order to leave comments, you need to log in
Everything works fine, BUT I update quite often, about 2 times per second. and DataTableAccounts is big (1000 rows)
<DataGrid x:Name="dg_last_run_params" CanUserAddRows="False" HorizontalScrollBarVisibility="Disabled" AutoGenerateColumns="False" IsReadOnly="True" SelectionMode="Extended"ItemsSource="{Binding}" Margin="5,3,0,0" FontSize="11" BorderBrush="{x:Null}" Grid.Column="1" Grid.Row="1" MouseLeave="dg_last_run_params_MouseLeave" SelectionChanged="dg_last_run_params_SelectionChanged">
<DataGrid.Columns>
<DataGridTextColumn Header="Param Name" MinWidth="140" Width="*" Binding="{Binding param_name}" ClipboardContentBinding="{x:Null}" FontSize="10"/>
<DataGridTextColumn Header="Param Value" MinWidth="170" Width="*" Binding="{Binding param_value}" ClipboardContentBinding="{x:Null}"/>
</DataGrid.Columns>
array_workflow_run_param.Clear();
array_workflow_run_param = session.Get_Workflow_Run_Params();
dg_last_run_params.ItemsSource = array_workflow_run_param;
dg_last_run_params.Items.Refresh();
internal class WorkflowParametersValue
{
public string param_name { get; set; }
public string param_value { get; set; }
public string param_man_value { get; set; }
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question