wpf treeview失去焦点后背景色的问题
wpf treeview treeviewitem失去焦点后背景色变为白天,非常难看,怎么设置treeviewitem失去焦点后变北京不变色,或者修改为其他颜色呢? wpf?treeview失去焦点
[解决办法]
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="IsExpanded" Value="True"/>
</Style>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="IsExpanded" Value="True"/>
<EventSetter Event="TreeViewItem.LostFocus" Handler="TreeViewItem_LostFocus"/>
</Style>
void TreeViewItem_LostFocus(object sender, RoutedEventArgs e)
{
TreeViewItem item = e.OriginalSource as TreeViewItem;
item.IsSelected = false;
}