Browse Source

Add description for attached properties

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/wpfdesigner@6007 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Kumar Devvrat 16 years ago
parent
commit
d6ba95a4b4
  1. 62
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/PropertyDescriptionService.cs

62
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/PropertyDescriptionService.cs

@ -12,29 +12,39 @@ using ICSharpCode.SharpDevelop.Editor.CodeCompletion;
namespace ICSharpCode.WpfDesign.AddIn namespace ICSharpCode.WpfDesign.AddIn
{ {
public class PropertyDescriptionService : IPropertyDescriptionService public class PropertyDescriptionService : IPropertyDescriptionService
{ {
OpenedFile file; OpenedFile file;
public PropertyDescriptionService(OpenedFile file) public PropertyDescriptionService(OpenedFile file)
{ {
if (file == null) if (file == null)
throw new ArgumentNullException("file"); throw new ArgumentNullException("file");
this.file = file; this.file = file;
} }
public object GetDescription(DesignItemProperty property) public object GetDescription(DesignItemProperty property)
{ {
IProjectContent pc = MyTypeFinder.GetProjectContent(file); IProjectContent pc = MyTypeFinder.GetProjectContent(file);
if (pc != null) { if (pc != null) {
IClass c = pc.GetClassByReflectionName(property.DeclaringType.FullName, true); // For attached Properties
if (c != null) { if (property.DependencyFullName != null && property.Name.Contains(".")) {
IMember m = DefaultProjectContent.GetMemberByReflectionName(c, property.Name); IClass c = pc.GetClassByReflectionName(property.DependencyProperty.OwnerType.FullName, true);
if (m != null) if (c != null) {
return CodeCompletionItem.ConvertDocumentation(m.Documentation); IMember m = DefaultProjectContent.GetMemberByReflectionName(c, property.DependencyProperty.Name + "Property");
} if (m != null)
} return CodeCompletionItem.ConvertDocumentation(m.Documentation);
return null; }
} } else {
} IClass c = pc.GetClassByReflectionName(property.DeclaringType.FullName, true);
} if (c != null) {
IMember m = DefaultProjectContent.GetMemberByReflectionName(c, property.Name);
if (m != null)
return CodeCompletionItem.ConvertDocumentation(m.Documentation);
}
}
}
return null;
}
}
}
Loading…
Cancel
Save