ISmartPartInfoProvider Members
public ISmartPartInfo GetSmartPartInfo(Type smartPartInfoType)
return new SmartPartInfo("Dashboard", "Your dashboard");
I agree that this isn’t very much trouble, but here is the smarter solution:
I added a new class into the Infrastructure project:
class SCSFUserControl : UserControl, ISmartPartInfoProvider
ISmartPartInfoProvider Members
public virtual ISmartPartInfo GetSmartPartInfo(Type smartPartInfoType)
Type me = GetType();
SmartPartInfoProviderAttribute[] atts = (SmartPartInfoProviderAttribute[])me.GetCustomAttributes(typeof(SmartPartInfoProviderAttribute), true);
if (atts.Length == 0)
return new SmartPartInfo();
return new SmartPartInfo(atts[0].Title, atts[0].Description);
Now we have to define the SmartPartInfoProviderAttribute:
AttributeUsage(AttributeTargets.Class)]
public class SmartPartInfoProviderAttribute : Attribute
public string Title;
public string Description;
public SmartPartInfoProviderAttribute() : this(string.Empty, string.Empty)
public SmartPartInfoProviderAttribute(string title, string description)
Creating a new smartpart now becomes easy:
SmartPartInfoProvider("Tasks", "Task list")]
public partial class TasklistView : SCSFUserControl, ITasklistView
And it will have a label in the Tabbed Workspace.