我有RadTreeView
并尝试使用stye触发器来禁用少数节点:
<telerikNavigation:RadTreeView ItemTemplate="{StaticResource HierarchyItemsTreeItemTemplate}">
<telerikNavigation:RadTreeView.Style>
<Style TargetType="telerikNavigation:RadTreeView">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=TreeViewItem}, Converter={StaticResource converter}}" Value="true">
<Setter Property="IsEnabled" Value="false"/>
</DataTrigger>
</Style.Triggers>
</Style>
</telerikNavigation:RadTreeView.Style>
</telerikNavigation:RadTreeView >
但是这给了我错误:
在样式
中找不到可附加属性触发器
答案 0 :(得分:1)
您似乎没有指定Style
应适用的属性telerikNavigation:RadTreeView.Style
。截至目前,您获得Style
作为Content
TreeView
尝试:
<telerikNavigation:RadTreeView ItemTemplate="{StaticResource HierarchyItemsTreeItemTemplate}">
<telerikNavigation:RadTreeView.Style> <!-- Missing Line from original Code -->
<Style TargetType="telerikNavigation:RadTreeView">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource FindAncestor,
AncestorType=TreeViewItem},
Converter={StaticResource converter}}"
Value="true">
<Setter Property="IsEnabled"
Value="false" />
</DataTrigger>
</Style.Triggers>
</Style>
</telerikNavigation:RadTreeView.Style> <!-- Missing Line from original Code -->
</telerikNavigation:RadTreeView>