Closed zc910704 closed 3 years ago
Already got the answer. Just watch the vs visual tree and query for the statusbar dockpanel. the visual studio may change it layout so it can't work in vs 2019.
So the code scans all the DockPanels in Visual Studio looking for the one called "StatusBarPanel". It returns null if it can't find one.
If you say that it's returning null when you run it in Visual Studio 2019, then perhaps they have removed or renamed the StatusBarPanel. That's annoying. I was not expecting it to change. I'll check out the VS tree and see what they are calling it now.
Your message has prompted me to update the extension for VS2019. I'm working on it today. Thanks for your interest.
This seems worked for me .It return the correct StatusBarPanel in my visual studio 2019.
DependencyObject rootGrid = VisualTreeHelper.GetChild(Application.Current.MainWindow, 0);
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(rootGrid); i++)
{
object o = VisualTreeHelper.GetChild(rootGrid, i);
if (o != null && o is DockPanel)
{
DockPanel dockPanel = o as DockPanel;
if (dockPanel.Name == "StatusBarPanel")
{
return dockPanel;
}
}
}
Thanks. I'll update my code as such.
Thanks again for the code fix for the Status Bar Panel. Works beautifully! You're a legend. Thanks mate!
Extension updated and upgraded for VS2019. Now available on the Marketplace.
hello, I just read your code and can't understand how does this function work. does it mean that get the dockpanel of statusbar where i can put my own control into it? and In my visual studio 2019 environment, it just return null. can you explain it ? thx.