Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
325
XamDockManager and TreeViewSelected error!
posted

I made a simple code to describe my curious but problematic situation.

I the XAML i have a window with a grid containing only the XamDockManger control, with a SplitPane on the bottom and a DocumentContentHost, that only contains a TreeView.

XAML

     <Grid>
        <igDock:XamDockManager Name="xamDockManager1">

            <igDock:XamDockManager.Panes>

                <igDock:SplitPane igDock:XamDockManager.InitialLocation="DockedBottom" x:Name="splitPane" SplitterOrientation="Horizontal">
                    <igDock:ContentPane IsPinned="False" x:Name="contentPane" Header="sads">
                        <TextBox x:Name="tb1"></TextBox>
                    </igDock:ContentPane>
                </igDock:SplitPane>

            </igDock:XamDockManager.Panes>

            <igDock:DocumentContentHost x:Name="centralProcContainer">
                <igDock:SplitPane>
                    <igDock:TabGroupPane>
                        <igDock:ContentPane>
                                <TreeView SelectedItemChanged="TreeView_SelectedItemChanged">
                                <TreeViewItem Header="1"></TreeViewItem>
                                <TreeViewItem Header="2">
                                    <TreeViewItem Header="4">
                                        <TreeViewItem Header="5"></TreeViewItem>
                                        <TreeViewItem Header="6"></TreeViewItem>
                                    </TreeViewItem>
                                </TreeViewItem>
                                <TreeViewItem Header="3"></TreeViewItem>
                            </TreeView>
                        </igDock:ContentPane>
                    </igDock:TabGroupPane>
                </igDock:SplitPane>
            </igDock:DocumentContentHost>
        </igDock:XamDockManager>
    </Grid>

Now in the c# code i have the event

CODE

         private void TreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
        {
            contentPane.Activate();
        }

Objective

The goal is to open the bottom split pane everytime you select a different item on tree view, and it works fine for the first nodes, but try to expand the treeview with the header 4, or 5 or 6 and select them, when the contentPane is activated i don't know how but the first node of the treeView of that branch is selected in last.

If anyone can tell me why this nodes 4,5 and 6 can't be selected and if there is a workaround i appreciate.

Best regards,
João Loureiro

 

 

Parents
No Data
Reply
  • 54937
    Verified Answer
    Offline posted

    I think the problem is that you are interfering with/altering the focused element while the treeview is responding to the item getting focus. You can sort of see this when you look at the callstack in the SelectedItemChanged. If you just want to bring the pane into view then you can call BringIntoView on it. Note, this will not focus the flyout so it will remain open until it is told to close

    If you really want to shift focus to the pane then you should probably do a begininvoke and call Activate asynchronously but you should be aware that you are going to prevent your users from being able to navigate the tree with the keyboard since everytime they navigate to a node you would move the keyboard focus to the content pane and therefore the tree won't have focus and they won't be able to continue navigating the tree.

Children
No Data