Showing a SmartPart in a Windows form

Tags van Technorati: ,

The easy part: create a form with a SmartPartPlaceholder on it.

Second: provide a property like this:

public UserControl SmartPart
{
    get { return (UserControl)smartPartPlaceholder1.SmartPart; }
    set { smartPartPlaceholder1.SmartPart = value; }
}

Third:

From within a presenter make a call like this:

internal void EditCompany(int id)
{
    CompanyDetailView view = WorkItem.SmartParts.AddNew<CompanyDetailView>("CompanyDetails");

    SmartFormBase frm = new SmartFormBase();
    frm.SmartPart = view;
    frm.ShowDialog();

    WorkItem.SmartParts.Remove(view);
}

This will display your smartpart inside a normal Windows form.

About Gaston

MCT, MCSD, MCDBA, MCSE, MS Specialist
This entry was posted in Geen categorie. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s