Example #1
0
        static void OnSelectedDocumentCategoryChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            ViewLayoutEditor editor = obj as ViewLayoutEditor;

            if (editor != null)
            {
                editor.ResetLayoutDefinitionVisibility();
            }
        }
        public void EnsureVisibleLayoutSelected()
        {
            // First, check to see if the selected item is SUPPOSED to be visible (at the point this is
            // called, it's possible the binding hasn't propagated yet)
            if ((this.SelectedItem is LayoutInstance && ((LayoutInstance)this.SelectedItem).IsVisible) ||
                (this.SelectedItem is LayoutDefinition) && ViewLayoutEditor.GetIsLayoutVisible((LayoutDefinition)this.SelectedItem))
            {
                // Do nothing
                return;
            }

            foreach (var item in this.Items)
            {
                if ((item is LayoutInstance && ((LayoutInstance)item).IsVisible) ||
                    (item is LayoutDefinition) && ViewLayoutEditor.GetIsLayoutVisible((LayoutDefinition)item))
                {
                    this.SelectedItem = item;
                    break;
                }
            }
        }