Пример #1
0
        private static object CoerceCanReorder(DependencyObject d, object value)
        {
            NavigationPaneOptions w = d as NavigationPaneOptions;

            return(w.navigationPane.ItemsSource == null);
        }
Пример #2
0
        private void ShowOptions()
        {
            if (RaiseConfigureWindowOpenedEvent())
            {
                NavigationPaneOptions o = new NavigationPaneOptions(this);
                o.Owner = Window.GetWindow(this);
                bool? result = o.ShowDialog();
                if (result.HasValue && result.Value == true)
                {
                    if (o.CanReorder)
                    {
                        DependencyObject[] items = new DependencyObject[Items.Count];
                        Items.CopyTo(items, 0);
                        Items.Clear();
                    }

                    ObservableCollection<NavigationPaneOptions.NavigationPaneOptionsData> data = o.Items;
                    foreach (NavigationPaneOptions.NavigationPaneOptionsData itemData in data)
                    {
                        DependencyObject item = itemData.item as DependencyObject;
                        if (o.CanReorder)
                            Items.Add(item);
                        SetIsItemExcluded(item as DependencyObject, !itemData.IsNotExcluded);
                    }
                    InvalidateMeasure();
                }
            }
        }