views:

120

answers:

2

I have a tab control with draggable tabs. When the mouse is released it removes the selected tab from the tabControl and adds it to its new location. My problem is that the TabControl draws itself after removing the tab, and then again when adding the tab so there is a very noticeable flicker that shows the tab behind the tab being moved.

Is there a way I can pause the UI thread so the tab control does not redraw until both the Remove and the Insert operations finish? Or perhaps some other alternative way of rearranging the tab items? The Drag/Drop operation exists in a separate code file as an Attached Property

A: 

Is it possible for you to remove/re-insert the tab once the drag is completed?

I'm assuming that your drag/drop functionality is using adorners to render the image while dragging. If you can listen to some sort of dragstarted/dragfinished events, you should be able to simply do nothing to your treeview while the item is dragging, and then remove/re-insert the tab once the drag has completed.

Robin
That is what I am doing... in the MouseUp event the item gets removed and re-inserted into the new location. My problem is that the tab control gets drawn after the removal and again after the re-insert which gives a very noticeable flicker showing the tab behind the tab being dragged.
Rachel
A: 

I actually found my problem had nothing to do with the Drag/Drop at all. It was a function that ran on the TabControl's SelectionChanged event that was causing the tabs to redraw when getting added and removed.

Rachel