More in this section

Forums / Developing with Sitefinity / Extend ContentItemPreview<THost>

Extend ContentItemPreview&lt;THost&gt;

4 posts, 0 answered
  1. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    03 Jun 2010
    Link to this post
    Hi Team,

    I have some problems to extend the ContentItemPreview of Telerik.Cms.Engine.WebControls.ContentItemPreview to adding one more visual preview  mode in GC Modules(Preview). My class is well implemented but have some troubles to add the head definition class pointing to the base

    public class ExtendContentItemPreview<THost> : ContentItemPreview<THost> <== NOT CORRECT

    After, i override the InitializeControls extending the default SetContentForm(currentContentItem) with my custom code.

    Thanks for help. Romi
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    03 Jun 2010
    Link to this post
    Hi Pierre,

    You should set the Host of your view

    public class ExtendContentItemPreview : ContentItemPreview<ExtendItemsView>

    /// </summary>
      public class ExtendItemsView : ViewModeControl<ExtendControlPanel>, IGenericContentHost
      {
          protected override void CreateViews()
          {
              AddView<ExtendContentItemPreview >();
          }
       }

    The base ContentItemPreview<THost> inherits from  ViewModeControl<THost> where THost : Control, IGenericContentHost

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    03 Jun 2010
    Link to this post
    Hi,

    I prefer expanding all previews modes extending the base class keeping the <THost>. The solution proposed is extending view by view declaring the THost, i searching to extend the base.

    Telerik.Cms.Engine.WebControls.ContentItemPreview<THost> inherits like you say from  ViewModeControl<THost> where THost : Control, IGenericContentHost. It's no way to inherit preserving the generic THost to avoid one base class extended to use that is heritable by views.

    ExtendContentItemPreview<THost> : ContentItemPreview<THost>

    thanks.

  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    03 Jun 2010
    Link to this post
    Hello Pierre,

    If you inherit from ViewModeControl<THost> you should implement all logic that comes with ontentItemPreview<THost>

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Register for webinar
4 posts, 0 answered