0

I'm writing a Windows GUI application using WPF and I found myself in a situation where the list style of Task Manager would best suit my needs.

What I specifically like is how subprocesses are TreeView-style nested in main processes

I would have just gone with a TreeView but two functionalities I find myself really needing is the ability to hover highlight over the entire width of the View

and how Item information remains aligned with the List Header

One nice side feature as will is the chevron on the right side and how it behaves exactly like a normal TreeView.

For the purposes of this project I can't use any other Component libraries and need to keep it to just WPF and .NET 4.7.1.

Any help pointing in the right direction of how to design a UI like this would be appreciated.

I've already tried messing with HierarchicalDataTemplate and StackPanels but I can't seem to find the right combination, though I could be missing something. I also tried modifying the ItemContainerStyle of the TreeView with no success:

<TreeView.ItemContainerStyle>
   <Style TargetType="TreeViewItem">
      <Setter Property="HorizontalContentAlignment" Value="Stretch" />
   </Style>
</TreeView.ItemContainerStyle>
  • You must overwrite the default ControlTemplate of the TreeView. This way you can allow the child items to span across the full width of the TreeView (if I remember correctly you must allow the ItemsPresenter that displays the children to span across both columns of the hosting Grid). While modifying the template you can also adjust the alignment of the expander and/or the item itself. –  Jun 26 '23 at 22:39
  • I don't think a TreeView is a good choice based on what you need it to do. I would start with a ListView or DataGrid where the row's could contain an Expander to show the details. [Expander binding in Listview](https://stackoverflow.com/questions/45402422/wpf-expander-binding-in-listview) ... [Expand Rows in WPF DataGrid](https://stackoverflow.com/questions/8165209/expand-row-in-wpf-datagrid) ... [Expand / Collapse for RowDetailsTemplate](https://stackoverflow.com/questions/3829137/i-need-the-expand-collapse-for-rowdetailstemplate) – quaabaam Jun 26 '23 at 23:17
  • @quaabaam The TreeView is the best control for his task: display hierarchical data aka parent-children data relationships aka tree data structure. You are basically suggesting to modify a flat data view to become a hierarchical data view. –  Jun 27 '23 at 06:07
  • @BionicCode. hopefully this can help you both: the program is supposed to be a gui to simulate an enclosure with slot cards, for demonstration purposes the user needs to be able to interact with an enclosure as a whole *and* "expand" an enclosure and interact with one of the slot cards directly. Similar to how a user might want to interact with a parent process or particular child process in Task Manager – Devak Nanda Jun 27 '23 at 15:32

0 Answers0