开发者

Wpf: Treeview updated or datatemplate applied event

The scenario is: In my Window, I have a TreeView; each item of this represents different user-defined types. So I have defined DataTemplate for each type. These DataTemplates are using user-controls and these usercontrols are binded with properties of user-defined types. As simple, TreeView maps a Hierarchical Data Structure of user-defined types.

Now I read from XML and create the Hierarchical structure and assign it to TreeView and it takes a lot of time to load. It already has some defa开发者_运维百科ult nodes and updates itself for other nodes.

I want to show a wait cursor until it get loaded and available to use for user, but I am not getting any event to notify me this. Is there any such event? What else can I do?


Try the LayoutUpdated event, as in...

Mouse.OverrideCursor = Cursors.Wait;
treeView.LayoutUpdated += treeView_LayoutUpdated;

void treeView_LayoutUpdated( object sender, EventArgs e )
{
    Mouse.OverrideCursor = null;
    treeView.LayoutUpdated -= treeView_LayoutUpdated;
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜