2 votes
closed
error with WPF SmartParts and ISmartPartInfoProvider

Description

 
I noticed today while creating my first wpf smartpart that it wasn't utilizing the GetSmartPartInfo method that was created when I implemented the ISmartPartInfoProvider interface. So I tracked the problem down to this snippet in CompositeUI.WPF.Workspaces.ElementHostWorkspace.Show(object smartPart) method:

object originalSmartPart = smartPart;
if (smartPart is UIElement)
{
smartPart = elementHosts.Wrap(smartPart as UIElement);
}

. . .

ISmartPartInfoProvider provider = smartPart as ISmartPartInfoProvider;

If you look at the underlined code, you see that smartpart has been assigned the WPF wrapper. Now unless the wrapper always implements ISmartPartInfoProvider (I don't think it does, period), then the variable 'provider' will always be null (because smartpart is now of type ElementHost). The correct code should be:

ISmartPartInfoProvider provider = originalSmartPart as ISmartPartInfoProvider;

File Attachments


No files are attached


Closed Apr 28 2008 at 7:19 PM  by MichaelPuleio
Fixed in SCSF April 2008

Comments

most recent at top (show oldest at top)

Updating...
© 2006-2009 Microsoft | About CodePlex | Privacy Statement | Terms of Use | Code of Conduct | Advertise With Us | Version 2009.10.27.15987