开发者

wpf datagrid adding items synchronously

开发者 https://www.devze.com 2023-02-03 03:32 出处:网络
I have a WPF Datagrid on my project. When user uploads documents(or selects folder) into program datagrid is being loaded by the document\'s whole properties(text, type, uri etc.). Especially when use

I have a WPF Datagrid on my project. When user uploads documents(or selects folder) into program datagrid is being loaded by the document's whole properties(text, type, uri etc.). Especially when user gives a folder to program it freezes for a time till it loads every folder. And on final step it populates the datagrid.

T开发者_JAVA百科he thing I really want to do is that loading datagrid rows as soon as a file is loaded successfully not at the end of the last process.

Could you show me some way..


Have you tried updating the DatGrid on a different thread?

here's an example of how it's done in WPF:

// Places the delegate onto the UI Thread's Dispatcher
private void timer_Elapsed(object sender, ElapsedEventArgs e)
{
    // Place delegate on the Dispatcher.
    this.Dispatcher.Invoke(DispatcherPriority.Normal,
        new TimerDispatcherDelegate(TimerWorkItem));
}

taken from msdn

0

精彩评论

暂无评论...
验证码 换一张
取 消