| | |
| | | using HMI.Base; |
| | | using HMI.UI; |
| | | using Panuon.WPF.UI; |
| | | using Plugin.SeqEditor.Entity; |
| | | using Plugin.SeqEditor.Util; |
| | | using Plugin.SeqEditor.ViewModel; |
| | | using System.Web.UI.WebControls; |
| | | using System.Windows; |
| | | using System.Windows.Controls; |
| | | using System.Windows.Data; |
| | | using System.Windows.Input; |
| | | |
| | |
| | | // col.Width = |
| | | //} |
| | | } |
| | | |
| | | public void HandleStatus(ItemContainerGenerator cg, StepUI step, bool status) |
| | | { |
| | | DependencyObject dObject = cg.ContainerFromItem(step); |
| | | if (status == true) |
| | | { |
| | | if (dObject is TreeViewItem item) |
| | | { |
| | | if (step.Children != null && step.Children.Count > 0) |
| | | { |
| | | if (item.IsExpanded != status) |
| | | { |
| | | item.IsExpanded = status; |
| | | item.UpdateLayout(); |
| | | } |
| | | foreach (var child in step.Children) |
| | | { |
| | | HandleStatus(item.ItemContainerGenerator, child, status); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (dObject is TreeViewItem item) |
| | | { |
| | | if (step.Children != null && step.Children.Count > 0) |
| | | { |
| | | foreach (var child in step.Children) |
| | | { |
| | | HandleStatus(item.ItemContainerGenerator, child, status); |
| | | } |
| | | item.IsExpanded = status; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public bool expandAll = false; |
| | | private void Button_Click(object sender, RoutedEventArgs e) |
| | | { |
| | | treeList.UpdateLayout(); |
| | | foreach (var item in treeList.Items) |
| | | { |
| | | if (item is StepUI step) |
| | | { |
| | | HandleStatus(treeList.ItemContainerGenerator, step, !expandAll); |
| | | } |
| | | } |
| | | expandAll = !expandAll; |
| | | //treeAll.Content = expandAll ? "一键收起" : "一键展开"; |
| | | } |
| | | } |
| | | |