How can I programmatically refresh Visual Studio WPF designers?
Is it possible to programmatically refresh WPF designer windows in Visual Studio e.g. using DTE?
I have some design-time behaviour where I would like to refresh WPF designer windows after file system changes I have detected.
I have tried开发者_开发技巧:
dte.ItemOperations.OpenFile(file) //where file is a xaml file
but this has no effect.
Update
I am looking for a solution where I do not close and then re-open the xaml file, as this is too heavy-handed. I'm looking for a way of getting WPF designers to reload\refresh as they do when the solution is rebuilt.
The best that i can think of is
dte.ActiveDocument.Close(vsSaveChanges.vsSaveChangesNo);
dte.ItemOperations.OpenFile(FileName);
精彩评论