This project is read-only.

SmartPartPlaceholdr does not show SmartPart

Sep 4, 2007 at 6:18 PM
Edited Sep 4, 2007 at 6:19 PM
I have a SmartPartPlaceholder on a ZoneWorkspace, SamrtPartPlaceholder ID is "SmartPart1", I add a smart part as follows (in the BeforeShellCreated):
RootWorkItem.SmartParts.AddNew<WelcomeView>("SmartPart1");

At this point, my SmartPartPlaceholder "SmartPart1" has SmartPart property set to WelcomeView (as expected), but view is not actually shown (Content property of the SmartPartPlaceholder is still null). I would expect Content to be set to WelcomeView.

AFAICT, SmartPartPlaceholer never sets content to the newly set SmartPart. Should it? I guess it shall be done as follows:

private static void SmartPartChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
{
Guard.ArgumentNotNull(e.NewValue, "value");
SmartPartPlaceholder smartPartPlaceholder = dependencyObject as SmartPartPlaceholder;
Debug.Assert(smartPartPlaceholder != null);
object newSmartPart = e.NewValue;
// NOTE: Set newly set SmartPart as a Content of this placeholder.
smartPartPlaceholder.Content = newSmartPart;
smartPartPlaceholder.OnSmartPartShown(new SmartPartPlaceHolderEventArgs(newSmartPart));
}