protected override void OnCreate() { base.OnCreate(); try { _trace.WriteLine(Resources.IntroMessage); var view = _compositionHost.GetExportedValue <VsixShellView>(); view.DataContext = _compositionHost.GetExportedValue <VsixShellViewModel>(); view.Resources.MergedDictionaries.Add(DataTemplateManager.CreateDynamicDataTemplates(_compositionHost.Container)); view.Loaded += view_Loaded; view.IsKeyboardFocusWithinChanged += view_IsKeyboardFocusWithinChanged; view.Track(UIElement.IsMouseOverProperty).Changed += view_IsMouseOverChanged; _dte = (EnvDTE.DTE)GetService(typeof(EnvDTE.DTE)); Contract.Assume(_dte != null); var executingAssembly = Assembly.GetExecutingAssembly(); var folder = Path.GetDirectoryName(executingAssembly.Location); _trace.WriteLine(Resources.AssemblyLocation, folder); _trace.WriteLine(Resources.Version, new AssemblyName(executingAssembly.FullName).Version); EventManager.RegisterClassHandler(typeof(VsixShellView), ButtonBase.ClickEvent, new RoutedEventHandler(Navigate_Click)); // This is the user control hosted by the tool window; Note that, even if this class implements IDisposable, // we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on // the object returned by the Content property. Content = view; _dte.SetFontSize(view); } catch (Exception ex) { _trace.TraceError("MyToolWindow OnCreate failed: " + ex); MessageBox.Show(string.Format(CultureInfo.CurrentCulture, Resources.ExtensionLoadingError, ex.Message)); } }