Browse Source

Fix SD-1760 - NullReferenceException when double-clicking button in WPF designer when .xaml file does not belong to a project

pull/14/head
Matt Ward 15 years ago
parent
commit
7929de1418
  1. 10
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/AbstractEventHandlerService.cs

10
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/AbstractEventHandlerService.cs

@ -26,13 +26,21 @@ namespace ICSharpCode.WpfDesign.AddIn @@ -26,13 +26,21 @@ namespace ICSharpCode.WpfDesign.AddIn
protected IProjectContent GetProjectContent()
{
IProject p = ProjectService.OpenSolution.FindProjectContainingFile(viewContent.PrimaryFileName);
IProject p = FindProjectContainingFile();
if (p != null)
return ParserService.GetProjectContent(p) ?? ParserService.DefaultProjectContent;
else
return ParserService.DefaultProjectContent;
}
IProject FindProjectContainingFile()
{
if (ProjectService.OpenSolution != null) {
ProjectService.OpenSolution.FindProjectContainingFile(viewContent.PrimaryFileName);
}
return null;
}
protected IClass GetDesignedClass()
{
Designer.Xaml.XamlDesignContext xamlContext = viewContent.DesignContext as Designer.Xaml.XamlDesignContext;

Loading…
Cancel
Save