Hi,
I'm using a TreeListView with many rows and columns. Expanding rows takes some time. That's why I want to change the mouse cursor to a wait cursor during the time the rendering of the rows takes place.
I found a solution for this problem for the TreeView in standard WPF:
I tried to rewrite the example for the TreeListView. Unfortunately, the ItemContainerGenerator of the TreeListView does not (unlike other older examples I found in this forum) contain a "Status" property or a "StatusChanged" event.
Is there another way for changing the mouse cursor during rendering time? All I need is an event that is raised when the rendering is finished.
Thanks a lot and best regards,
Frank
I'm using a TreeListView with many rows and columns. Expanding rows takes some time. That's why I want to change the mouse cursor to a wait cursor during the time the rendering of the rows takes place.
I found a solution for this problem for the TreeView in standard WPF:
private
void
TreeNodeExpanded(
object
sender, RoutedEventArgs e)
{
TreeViewItem tvi = e.OriginalSource
as
TreeViewItem;
if
(tvi !=
null
)
{
if
(tvi.ItemContainerGenerator.Status != GeneratorStatus.ContainersGenerated)
{
EventHandler itemsGenerated =
null
;
itemsGenerated =
delegate
(
object
s, EventArgs args)
{
if
((s
as
ItemContainerGenerator).Status == GeneratorStatus.ContainersGenerated)
{
(s
as
ItemContainerGenerator).StatusChanged -= itemsGenerated;
tvi.Dispatcher.BeginInvoke(DispatcherPriority.DataBind,
(ThreadStart)
delegate
{
Mouse.OverrideCursor =
null
;
});
}
};
tvi.ItemContainerGenerator.StatusChanged += itemsGenerated;
Mouse.OverrideCursor = Cursors.Wait;
}
}
}
I tried to rewrite the example for the TreeListView. Unfortunately, the ItemContainerGenerator of the TreeListView does not (unlike other older examples I found in this forum) contain a "Status" property or a "StatusChanged" event.
Is there another way for changing the mouse cursor during rendering time? All I need is an event that is raised when the rendering is finished.
Thanks a lot and best regards,
Frank