Subclassing RadTreeViewItem

2 posts, 0 answers
  1. Owen
    Owen avatar
    7 posts
    Member since:
    Apr 2009

    Posted 20 Jul 2009 Link to this post

        public class Subclass : RadTreeViewItem 
        { 
        } 
    <telerik:RadTreeView> 
            <local:Subclass Header="Group -1"/> 
    </telerik:RadTreeView> 
    Everything compiles, runs, I just see no Item in the TreeView...I shouldn't have to override the metadata for the DefaultStyleKey should I; it should just inherit by default. 
  2. Bobi
    Admin
    Bobi avatar
    513 posts

    Posted 21 Jul 2009 Link to this post

    Hello Owen,

    Please find attached a sample project that shows how to create a custom item for RadTreeView.
    All you need to do is just:

    1. Add references to Telerik.Windows.Controls.dll and Telerik.Windows.Controls.Navigation.dll

    2.Add some class for the custom item like:

        class CustomtreeViewItem  :RadTreeViewItem
        { ...}

    3.Include the newly created class name space :

    xmlns:local="clr-namespace:TreeView_Test"

    4. Add some CustomTreeviewItem in your RadTreeView:

          <controls:RadTreeView>
                <local:CustomtreeViewItem Header="test" />
            </controls:RadTreeView>

    I hope that this will help you.

    Best wishes,
    Boryana
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top