The attachable property Triggers was not found in Style wile writing Style Triggers

2 posts, 0 answers
  1. Subhendu
    Subhendu avatar
    10 posts
    Member since:
    Mar 2013

    Posted 21 Aug 2013 Link to this post

    I have a  RadTreeView and I am trying to use stye triggers for disabling few nodes:
    <telerikNavigation:RadTreeView  ItemTemplate="{StaticResource HierarchyItemsTreeItemTemplate}">
            <Style TargetType="telerikNavigation:RadTreeView">
                    <DataTrigger Binding="{Binding RelativeSource={RelativeSource FindAncestor,
        AncestorType=TreeViewItem}, Converter={StaticResource converter}}"
                         <Setter Property="IsEnabled" Value="false"/>
        </telerikNavigation:RadTreeView >

    But this gives me error: The attachable property Triggers was not found in Style.  Is there any alternate approach and Triggers are being obsolete?
  2. Tina Stancheva
    Tina Stancheva avatar
    3299 posts

    Posted 21 Aug 2013 Link to this post


    Unfortunately I can't tell for sure what's going wrong with your approach as I can't reproduce this issue locally. However, I feel that there might be something missing in the code snippet you sent as you can't place a style definition directly within a RadTreeView definition.

    Another thing I've noticed is that your DataTrigger is looking for an object of type TreeViewItem but you're working with RadTreeView and I'm not sure whether you've placed the RadTreeView within a native TreeView control or if this is a typo.

    In any case, if your scenario requires an implementation where the RadTreeViewItems are disabled based on the value of a property from their underlying business object then you can use one of two approaches:
    • use DataTriggers but in the Triggers section of a Style targeting telerik:RadTreeViewItem:
    <Style TargetType="telerik:RadTreeViewItem">
            <DataTrigger Binding="{Binding Unavailable}" Value="true">
                <Setter Property="IsEnabled" Value="false" />

    • use a Style Setter and bind the RadTreeViewItem IsEnabled property to a business property
    <Style TargetType="telerik:RadTreeViewItem">
        <Setter Property="IsEnabled" Value="{Binding Unavailable}" />

    I demonstrated both approaches in the attached sample so please let me know if they help.

    Tina Stancheva
    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 >>
Back to Top