private static void OnItemsSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var group    = d as RadPaneGroup;
            var oldValue = e.OldValue as IEnumerable;
            var newValue = e.NewValue as IEnumerable;
            var oldValueObservableCollection = e.OldValue as INotifyCollectionChanged;
            var newValueObservableCollection = e.NewValue as INotifyCollectionChanged;

            if (group != null)
            {
                var extension = GetPaneGroupExtension(group);
                if (extension == null)
                {
                    extension = new PaneGroupExtensions {
                        Group = group
                    };
                    SetPaneGroupExtension(group, extension);
                }

                if (oldValue != null)
                {
                    foreach (var paneModel in oldValue)
                    {
                        extension.RemoveItem(paneModel);
                    }

                    if (oldValueObservableCollection != null)
                    {
                        oldValueObservableCollection.CollectionChanged -= extension.OnItemsSourceCollectionChanged;
                    }
                }

                if (newValue != null)
                {
                    foreach (var paneModel in newValue)
                    {
                        extension.AddItem(paneModel);
                    }

                    if (newValueObservableCollection != null)
                    {
                        newValueObservableCollection.CollectionChanged += extension.OnItemsSourceCollectionChanged;
                    }
                }
            }
        }
Exemplo n.º 2
0
        private static void OnItemsSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var group = d as RadPaneGroup;
            var oldValue = e.OldValue as IEnumerable;
            var newValue = e.NewValue as IEnumerable;
            var oldValueObservableCollection = e.OldValue as INotifyCollectionChanged;
            var newValueObservableCollection = e.NewValue as INotifyCollectionChanged;

            if (group != null)
            {
                var extension = GetPaneGroupExtension(group);
                if (extension == null)
                {
                    extension = new PaneGroupExtensions { Group = group };
                    SetPaneGroupExtension(group, extension);
                }

                if (oldValue != null)
                {
                    foreach (var paneModel in oldValue)
                    {
                        extension.RemoveItem(paneModel);
                    }

                    if (oldValueObservableCollection != null)
                    {
                        oldValueObservableCollection.CollectionChanged -= extension.OnItemsSourceCollectionChanged;
                    }
                }

                if (newValue != null)
                {
                    foreach (var paneModel in newValue)
                    {
                        extension.AddItem(paneModel);
                    }

                    if (newValueObservableCollection != null)
                    {
                        newValueObservableCollection.CollectionChanged += extension.OnItemsSourceCollectionChanged;
                    }
                }
            }
        }
Exemplo n.º 3
0
 private static void SetPaneGroupExtension(DependencyObject obj, PaneGroupExtensions value)
 {
     obj.SetValue(PaneGroupExtensionProperty, value);
 }
 private static void SetPaneGroupExtension(DependencyObject obj, PaneGroupExtensions value)
 {
     obj.SetValue(PaneGroupExtensionProperty, value);
 }