我无法让TreeViewItem更改行颜色

时间:2019-06-04 15:03:45

标签: listview

我有这个树状视图                                                                                                                                                                                                     

                    <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;

我需要访问特定项目以更改颜色

0 个答案:

没有答案