Exemplo n.º 1
0
        public void FocusNotesList()
        {
            App.Logger.Trace("NotesViewHierachical", "FocusNotesList");

            HierachicalNotesList.Focus();
            Keyboard.Focus(HierachicalNotesList);

            HierachicalNotesList.UpdateLayout();
            if (HierachicalNotesList.SelectedItem == null)
            {
                return;
            }

            var listBoxItem = HierachicalNotesList.ItemContainerGenerator.ContainerFromItem(HierachicalNotesList.SelectedItem) as ListBoxItem;

            if (listBoxItem == null)
            {
                return;
            }

            listBoxItem.Focus();
        }
Exemplo n.º 2
0
        private void OnSelectedNoteChanged()
        {
            App.Logger.TraceExt("NotesViewHierachical",
                                "OnSelectedNoteChanged",
                                Tuple.Create("SelectedNote", SelectedNote?.Title),
                                Tuple.Create("SelectedFolder", SelectedFolder?.Header));

            if (SelectedNote != null && (SelectedFolder == null || !SelectedFolder.AllSubNotes.Contains(SelectedNote)))
            {
                if (DisplayItems.AllNotesViewWrapper != null)
                {
                    App.Logger.TraceExt("NotesViewHierachical",
                                        "OnSelectedNoteChanged (1)",
                                        Tuple.Create("AllNotesWrapper.IsSelected", "true"));

                    DisplayItems.AllNotesViewWrapper.IsSelected = true;
                }
                else
                {
                    var fldr = DisplayItems.Find(SelectedNote);
                    if (fldr != null)
                    {
                        App.Logger.TraceExt("NotesViewHierachical",
                                            "OnSelectedNoteChanged (2)",
                                            Tuple.Create("DisplayItems.Find(SelectedNote).IsSelected", "true"));

                        fldr.IsSelected = true;
                    }
                }
            }

            if (SelectedNote != null)
            {
                HierachicalNotesList.ScrollIntoView(SelectedNote);
            }
        }