Datagrid在填充之前返回控制 [英] Datagrid returns control before populated
问题描述
我正在使用数据网格控件,我从XML数据源填充它,当我将ItemsSource属性设置为集合,然后尝试使用SelectedIndex选择数据网格中的项目时,Sketchflow会死掉。 / p>
我猜测由于某种原因,Microsoft决定将datagrid填充为异步进程。不幸的是,没有提供任何事件来检测数据网格何时被填满。
我最终做的是一个讨厌的kludge,它计算Threading.DispatcherTimer集上的行数对于200ms并等待直到显示一些行,看起来好像任何大于零的数字都有效。
一旦我检测到我可以设置SelectedIndex值而没有Sketchflow给我死亡的白屏。
我必须这样做,因为我有一个包含各种控件和数据网格的TabControl,它不会在导航操作之间保持状态!
你好,
我很高兴 看到你的问题,类似的解决方案就是我在博客上发布的博客,这可能会帮助你做很多事情
这是我的博客,
http://www.expression-blend.com
我希望它帮助你!
问候,
I'm using a datagrid control and I am populating it from an XML data source, when I set the ItemsSource property to the collection and then try to select and item in the datagrid using SelectedIndex, Sketchflow dies.
I am guessing that for some reason Microsoft decided to make the filling of the datagrid an asynchronous process. Unfortunately, no event has been provided to detect when the datagrid has been filled.
What I've ended up doing is a nasty kludge that counts the number of rows on a Threading.DispatcherTimer set for 200ms and waits until there are some rows displayed, it looks as if any number greater than zero works.
Once I've detected that I can set the SelectedIndex value without Sketchflow giving me the white screen of death.
I have to do this because I have a TabControl that contains various controls and a datagrid and it does not keep its state between navigation actions!
Hello ,
I am glad to see your question, similar solution is what I have blogged on my blog and that might help you a lot in doing very stuffHere is my blog,
http://www.expression-blend.com
I hope it helps you out !
Regards,
这篇关于Datagrid在填充之前返回控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!