开发者

Wpf: Treeview updated or datatemplate applied event

开发者 https://www.devze.com 2022-12-24 06:13 出处:网络
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 a

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

精彩评论

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