This is a migrated thread and some comments may be shown as answers.

Extending RadTreeView & RadTreeViewItem

1 Answer 93 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
DTA
Top achievements
Rank 1
DTA asked on 04 Mar 2013, 12:45 PM
Hi,

Purpose: extending the RadTreeView & RadTreeViewItem
In order to immplement the purpose above i had to inherit the both classes.
When i binding the NewRadTreeView ItemSource to viewmodel
i found the previous RadTreeViewItem instead NewRadTreeViewItem.

In order to use my NewRadTreeViewItem i did the override below in NewRadTreeView & NewRadTreeViewItem:
protected override DependencyObject GetContainerForItemOverride()
{
    var rti = base.GetContainerForItemOverride();
    if(rti is RadTreeViewItem)
    {
        rti = new NewRadTreeView();
    }
}

I wonder if i'll have to expect for other things that might affect?
What about the AddItem, Next, Previous etc...?

Best regards

1 Answer, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 07 Mar 2013, 12:27 PM
Hello,

In order to extend the RadTreeViewItem you have to override the IsItemItsOwnContainerOverride() method of the RadTreeView control. This method has to return false when its parameter equals the type of your customized RadTreeViewItem. By doing so the GetContainerForItemOverride() method will be invoked and you will be able to return a new instance of your extended RadTreeViewItem. For your convenience I implemented the approach in the attached solution. Please take a look at it and let me know if you need further assistance.

Regards,
Pavel R. Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
TreeView
Asked by
DTA
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Share this question
or