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

RadTreeListView inheritance.

1 Answer 61 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Anton
Top achievements
Rank 1
Anton asked on 09 Oct 2013, 04:14 PM
I've tried to inherit class from RadTreeListView and add it on form via XAML and app shows nothing in debug.
How can I fix it quickly?
RadControls version = 2011.3.1220.40

public class TestTreeView : RadTreeListView
{
}
<controls:TestTreeView ItemsSource="{Binding Items}" />  -> empty screen
...
<t:RadTreeListView ItemsSource="{Binding Items}" />  -> fine

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 11 Oct 2013, 02:17 PM
Hello,

If you are setting the theme to your custom grid using StyleManager you have to set the DefaultStyleKey in the OnInitialized method. In general we are using composite key to set the theme to per control.
The snippet below demonstrates how to set any Telerik theme to a custom control named TestTreeView, which inherits RadTreeListView: 

public class TestTreeView:RadTreeListView
{
    static TestTreeView()
    {
        DefaultStyleKeyProperty.OverrideMetadata(typeof(MyCustomGrid), new FrameworkPropertyMetadata(typeof(MyCustomGrid)));
    }
 
    protected override void OnInitialized(EventArgs e)
    {
        base.OnInitialized(e);
        Theme theme = StyleManager.GetTheme(this);
        Type themeType = null;
        if (theme != null)
        {
            themeType = theme.GetType();
        }
        this.DefaultStyleKey = new ThemeResourceKey() { ElementType = typeof(RadTreeListView), ThemeType = themeType };
    }
}


You can also check this forum thread.

I hope this helps.


Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
TreeListView
Asked by
Anton
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or