Ejemplo n.º 1
0
        public MarkedTreeNode FindNext(bool select)
        {
            MarkedTreeNode nextMatch = FindNextMarkers(m_MarkedTreeNodes);

            if (nextMatch != null)
            {
                var listItem = VisualLogicalTreeWalkHelper.FindObjectInVisualTreeWithMatchingType <ListViewItem>(
                    m_view.ListView,
                    child =>
                {
                    object dc = child.GetValue(FrameworkElement.DataContextProperty);
                    return(dc != null && dc == nextMatch);
                });
                if (select)
                {
                    nextMatch.IsSelected = true;
                    if (listItem != null)
                    {
                        FocusHelper.FocusBeginInvoke(listItem); //m_view.m_LastListItemSelected
                    }
                }
                else
                {
                    if (listItem != null)
                    {
                        listItem.BringIntoView();
                    }
                }
            }
            else
            {
                AudioCues.PlayBeep();
            }
            return(nextMatch);
        }
Ejemplo n.º 2
0
        public DescribableTreeNode FindPrevious(bool select)
        {
            DescribableTreeNode previousMatch = FindPrevDescription(m_DescribableTreeNodes);

            if (previousMatch != null)
            {
                var listItem = VisualLogicalTreeWalkHelper.FindObjectInVisualTreeWithMatchingType <ListViewItem>(
                    m_view.ListView,
                    child =>
                {
                    object dc = child.GetValue(FrameworkElement.DataContextProperty);
                    return(dc != null && dc == previousMatch);
                });
                if (select)
                {
                    previousMatch.IsSelected = true;
                    if (listItem != null)
                    {
                        FocusHelper.FocusBeginInvoke(listItem); //m_view.m_LastListItemSelected
                    }
                }
                else
                {
                    if (listItem != null)
                    {
                        listItem.BringIntoView();
                    }
                }
            }
            else
            {
                AudioCues.PlayBeep();
            }
            return(previousMatch);
        }
Ejemplo n.º 3
0
        private RecentFileWrapper FindPrevious(bool select)
        {
            RecentFileWrapper previousMatch = FindPrevSetting();

            if (previousMatch != null)
            {
                if (select)
                {
                    previousMatch.IsSelected = true;
                }
                else
                {
                    var listItem = VisualLogicalTreeWalkHelper.FindObjectInVisualTreeWithMatchingType <ListViewItem>(
                        RecentFilesList,
                        child =>
                    {
                        object dc = child.GetValue(FrameworkElement.DataContextProperty);
                        return(dc != null && dc == previousMatch);
                    });
                    if (listItem != null)
                    {
                        listItem.BringIntoView();
                    }
                }
            }
            else
            {
                AudioCues.PlayBeep();
            }
            return(previousMatch);
        }
        public HeadingTreeNodeWrapper FindPrevious(bool select)
        {
            ExpandAll();

            HeadingTreeNodeWrapper prevMatch = FindPrevMatch(m_roots);

            if (prevMatch != null)
            {
                if (select)
                {
                    //prevMatch.IsSelected = true;
                    ViewModel.View.SelectTreeNodeWrapper(prevMatch, true);
                }
                else
                {
                    var treeViewItem = VisualLogicalTreeWalkHelper.FindObjectInVisualTreeWithMatchingType <TreeViewItem>(
                        ViewModel.View.TreeView,
                        child =>
                    {
                        object dc = child.GetValue(FrameworkElement.DataContextProperty);
                        return(dc != null && dc == prevMatch);
                    });
                    if (treeViewItem != null)
                    {
                        treeViewItem.BringIntoView();
                    }
                }
            }
            else
            {
                AudioCues.PlayBeep();
            }

            return(prevMatch);
        }
Ejemplo n.º 5
0
        private SettingWrapper FindNext(bool select)
        {
            SettingWrapper nextMatch = FindNextSetting();

            if (nextMatch != null)
            {
                if (select)
                {
                    nextMatch.IsSelected = true;
                }
                else
                {
                    var listItem = VisualLogicalTreeWalkHelper.FindObjectInVisualTreeWithMatchingType <ListViewItem>(
                        SettingsList,
                        child =>
                    {
                        object dc = child.GetValue(FrameworkElement.DataContextProperty);
                        return(dc != null && dc == nextMatch);
                    });
                    if (listItem != null)
                    {
                        listItem.BringIntoView();
                    }
                }
            }
            else
            {
                AudioCues.PlayBeep();
            }
            return(nextMatch);
        }
        private void SelectValidationItem(ValidationItem selection)
        {
            if (selection == null)
            {
                return;
            }

            DataTemplate template         = Tabs.ContentTemplate;
            var          contentPresenter = VisualLogicalTreeWalkHelper.FindObjectInVisualTreeWithMatchingType <ContentPresenter>(Tabs, null);
            var          list             = (ListBox)template.FindName("ValidationItemsListBox", contentPresenter);

            if (list != null)
            {
                list.SelectedItem = selection;
                list.ScrollIntoView(selection);
            }
        }
        private void SelectFirstInValidationItemsList()
        {
            DataTemplate template         = Tabs.ContentTemplate;
            var          contentPresenter = VisualLogicalTreeWalkHelper.FindObjectInVisualTreeWithMatchingType <ContentPresenter>(Tabs, null);

            if (contentPresenter == null)
            {
                return;
            }
            var list = (ListBox)template.FindName("ValidationItemsListBox", contentPresenter);

            if (list == null)
            {
                return;
            }

            if (list.Items.Count > 0)
            {
                list.SelectedItem = list.Items[0];
            }
        }