我有这个树状视图
<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}" BasedOn="{StaticResource FilterFieldTreeViewItem}">
<EventSetter Event="KeyDown" Handler="OnFilterListItemKeyDown"/>
</Style>
</TreeView.ItemContainerStyle>
</TreeView>
并且我无法通过此代码转换TreeViewItem
TreeViewItem ti =(TreeViewItem)_filterDisplay.Items [i]; ti.Foreground = Brushes.Red;
我需要访问特定项目以更改颜色