如何使WPF的TreeView节点之间有连线

如何使WPF的TreeView节点之间有连线,第1张

用两种思路来解决此问题。

第一种,运用TreeView的SelectedItemChanged事件

假设TreeView控件悔升歼的name是treeview

c#参考代码碧冲:

private void treeview_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object>e)

{

TreeViewItem selected_item = treeview.SelectedItem as TreeViewItem

TreeViewItem item

if (selected_item != null)

{

for (int i = 0i <treeview.Items.Counti++)

{

item = treeview.Items[i] as TreeViewItem

if (item != selected_item)

{

item.IsExpanded = false

}

}

}

}

第二种思路是更改TreeViewItem的style啦!~

参考代码

<Style TargetType="{x:Type TreeViewItem}">

<Style.Triggers>

<MultiTrigger>

<MultiTrigger.Conditions>

<Condition Property="IsSelected" Value="True"/>

<Condition Property="IsFocused" Value="True"/>

</MultiTrigger.Conditions>

<Setter Property="IsExpanded" Value="True"/>

</MultiTrigger>

<Trigger Property="IsSelected"笑笑 Value="False" >

<Setter Property="IsExpanded" Value="False"/>

</Trigger>

</Style.Triggers>

</Style>

BIAS0:= (C-MA(C,2))/拆岩迹MA(C,2)*100

BIAS1 := (C-MA(C,12))/MA(C,12)*100

BIAS2 := (C-MA(C,26))/枣做MA(C,26)*100

BIAS3 := (C-MA(C,48))/MA(C,48)*100

HXL:=V/CAPITAL*100

D1:=INDEXC

D2:=MA(D1,56)

DR2:=D1/D2<0.94

E1:=(C-HHV(C,12))/HHV(C,12)*10

E2:=(C-REF(C,26))/旅并REF(C,26)*10


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/bake/11976998.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-20
下一篇 2023-05-20

发表评论

登录后才能评论

评论列表(0条)

保存