Click here to Skip to main content
15,913,225 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Impossible? Get instance of MainWindow from extern WPF-application Pin
Richard Deeming22-Mar-21 22:40
mveRichard Deeming22-Mar-21 22:40 
GeneralRe: Impossible? Get instance of MainWindow from extern WPF-application Pin
Mc_Topaz23-Mar-21 4:02
Mc_Topaz23-Mar-21 4:02 
AnswerRe: Impossible? Get instance of MainWindow from extern WPF-application Pin
Gerry Schmitz23-Mar-21 7:27
mveGerry Schmitz23-Mar-21 7:27 
GeneralRe: Impossible? Get instance of MainWindow from extern WPF-application Pin
Mc_Topaz23-Mar-21 12:22
Mc_Topaz23-Mar-21 12:22 
GeneralRe: Impossible? Get instance of MainWindow from extern WPF-application Pin
Richard Deeming23-Mar-21 23:14
mveRichard Deeming23-Mar-21 23:14 
GeneralRe: Impossible? Get instance of MainWindow from extern WPF-application Pin
Gerry Schmitz24-Mar-21 5:40
mveGerry Schmitz24-Mar-21 5:40 
GeneralRe: Impossible? Get instance of MainWindow from extern WPF-application Pin
Mc_Topaz25-Mar-21 0:02
Mc_Topaz25-Mar-21 0:02 
QuestionWPF DataGrid Custom Group Header Pin
Kevin Marois22-Mar-21 8:47
professionalKevin Marois22-Mar-21 8:47 
AnswerRe: WPF DataGrid Custom Group Header Pin
Richard Deeming22-Mar-21 22:35
mveRichard Deeming22-Mar-21 22:35 
QuestionDynamic WPF DataGrid Pin
Kevin Marois19-Mar-21 10:41
professionalKevin Marois19-Mar-21 10:41 
AnswerRe: Dynamic WPF DataGrid Pin
Richard Deeming21-Mar-21 22:50
mveRichard Deeming21-Mar-21 22:50 
GeneralRe: Dynamic WPF DataGrid Pin
Kevin Marois22-Mar-21 7:07
professionalKevin Marois22-Mar-21 7:07 
GeneralRe: Dynamic WPF DataGrid Pin
Kevin Marois23-Mar-21 9:58
professionalKevin Marois23-Mar-21 9:58 
GeneralRe: Dynamic WPF DataGrid Pin
Richard Deeming23-Mar-21 23:13
mveRichard Deeming23-Mar-21 23:13 
GeneralRe: Dynamic WPF DataGrid Pin
Kevin Marois24-Mar-21 6:14
professionalKevin Marois24-Mar-21 6:14 
QuestionWPF with TPL Multithreading Pin
#realJSOP16-Mar-21 6:04
professional#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
professional#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
professional#realJSOP16-Mar-21 10:51 
QuestionExpand/Collapse TreeView Nodes on Ctrl+LeftMouse in WPF Pin
ernie_hudds12-Mar-21 4:24
ernie_hudds12-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
lmoelleb15-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
sinagot4-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 

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.