Click here to Skip to main content
14,921,745 members
Home / Discussions / WPF
   

WPF

 
QuestionWPF with TPL Multithreading Pin
#realJSOP16-Mar-21 6:04
mva#realJSOP16-Mar-21 6:04 
AnswerRe: WPF with TPL Multithreading Pin
Gerry Schmitz16-Mar-21 7:45
mveGerry Schmitz16-Mar-21 7:45 
GeneralRe: WPF with TPL Multithreading Pin
#realJSOP16-Mar-21 9:03
mva#realJSOP16-Mar-21 9:03 
GeneralRe: WPF with TPL Multithreading Pin
Gerry Schmitz16-Mar-21 10:11
mveGerry Schmitz16-Mar-21 10:11 
GeneralRe: WPF with TPL Multithreading Pin
#realJSOP16-Mar-21 10:51
mva#realJSOP16-Mar-21 10:51 
QuestionExpand/Collapse TreeView Nodes on Ctrl+LeftMouse in WPF Pin
earnshaw194312-Mar-21 4:24
Memberearnshaw194312-Mar-21 4:24 
AnswerRe: Expand/Collapse TreeView Nodes on Ctrl+LeftMouse in WPF Pin
Gerry Schmitz12-Mar-21 8:13
mveGerry Schmitz12-Mar-21 8:13 
AnswerRe: Expand/Collapse TreeView Nodes on Ctrl+LeftMouse in WPF Pin
lmoelleb15-Mar-21 8:40
Memberlmoelleb15-Mar-21 8:40 
As Gerry mentioned, you need to hook up a handler for the mouse click and check the status of the CTRL key.

You then go through all your child ViewModels and flip the property you databound to the IsExpanded property.

This is how you can databind the IsExpanded property (and take IsSelected along for the ride if you need it - makes it VERY easy to select an item programmatically):
<TreeView.ItemContainerStyle>
    <Style TargetType="{x:Type TreeViewItem}">
        <Setter Property="IsExpanded" Value="{Binding Path=IsExpanded, Mode=TwoWay}"/>
        <Setter Property="IsSelected" Value="{Binding Path=IsSelected, Mode=TwoWay}"/>
    </Style>
</TreeView.ItemContainerStyle>

In case you do not have a view model for your tree items you have two options:
1. Switch to WinForm
2. Introduce the view model

I supposed you could also try calling methods on the tree view control itself to find it's children, but it will be a LOT more code than the viewmodel, specifically when it start delay loading and virtualizing etc. WPF was designed for a ViewModel, and going against that is always asking for pain.
QuestionAvalonDock using AvalonDock.ManagedContent not present in Dirkster.AvalonDock package Pin
sinagot4-Mar-21 1:24
Membersinagot4-Mar-21 1:24 
AnswerRe: AvalonDock using AvalonDock.ManagedContent not present in Dirkster.AvalonDock package Pin
Gerry Schmitz4-Mar-21 8:24
mveGerry Schmitz4-Mar-21 8:24 
GeneralRe: AvalonDock using AvalonDock.ManagedContent not present in Dirkster.AvalonDock package Pin
sinagot4-Mar-21 10:50
Membersinagot4-Mar-21 10:50 
QuestionDataGrid Columnm Header Style Pin
Kevin Marois16-Feb-21 14:44
professionalKevin Marois16-Feb-21 14:44 
AnswerRe: DataGrid Columnm Header Style Pin
Gerry Schmitz17-Feb-21 6:14
mveGerry Schmitz17-Feb-21 6:14 
QuestionGridView CellTemplate Pin
#realJSOP13-Feb-21 10:42
mva#realJSOP13-Feb-21 10:42 
AnswerRe: GridView CellTemplate Pin
Gerry Schmitz13-Feb-21 12:50
mveGerry Schmitz13-Feb-21 12:50 
GeneralRe: GridView CellTemplate Pin
#realJSOP13-Feb-21 13:13
mva#realJSOP13-Feb-21 13:13 
AnswerRe: GridView CellTemplate Pin
#realJSOP14-Feb-21 4:49
mva#realJSOP14-Feb-21 4:49 
GeneralRe: GridView CellTemplate Pin
Gerry Schmitz14-Feb-21 5:53
mveGerry Schmitz14-Feb-21 5:53 
GeneralRe: GridView CellTemplate Pin
#realJSOP14-Feb-21 8:41
mva#realJSOP14-Feb-21 8:41 
GeneralRe: GridView CellTemplate Pin
Gerry Schmitz14-Feb-21 10:48
mveGerry Schmitz14-Feb-21 10:48 
QuestionIcon Strangeness Pin
#realJSOP2-Feb-21 23:36
mva#realJSOP2-Feb-21 23:36 
AnswerRe: Icon Strangeness Pin
Richard Deeming3-Feb-21 0:12
mveRichard Deeming3-Feb-21 0:12 
GeneralRe: Icon Strangeness Pin
#realJSOP3-Feb-21 1:25
mva#realJSOP3-Feb-21 1:25 
AnswerRe: Icon Strangeness Pin
Gerry Schmitz3-Feb-21 7:25
mveGerry Schmitz3-Feb-21 7:25 
QuestionDispatcherTimer Pin
michaelbarb14-Jan-21 6:29
Membermichaelbarb14-Jan-21 6:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.