SetFilter() 공개 메소드

public SetFilter ( CollectionVM collection, FilterExpressionData filter ) : void
collection a7DocumentDbStudio.ViewModel.CollectionVM
filter a7DocumentDbStudio.Filter.FilterExpressionData
리턴 void
 protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
 {
     base.OnPropertyChanged(e);
     if (e.Property == CollectionProperty && _collection != e.NewValue as CollectionVM)
     {
         if (_fePopupControl != null)
         {
             _fePopupControl.SetCollection(e.NewValue as CollectionVM);
             _collection = e.NewValue as CollectionVM;
             if (this.FilterExpr != null)
             {
                 _fePopupControl.SetFilter(_collection, FilterExpr);
             }
         }
         else
         {
             _collection = e.NewValue as CollectionVM;
         }
     }
     else if (e.Property == FilterExprProperty)
     {
         if (_fePopupControl != null && this._collection != null)
         {
             _fePopupControl.SetFilter(this._collection, e.NewValue as FilterExpressionData);
         }
         else
         {
             this.FilterExpr = e.NewValue as FilterExpressionData;
         }
         if (this.FilterExpr != null && FilterExpr.HasActiveFilter)
         {
             this.ActiveBackground = Brushes.Red;
         }
         else
         {
             this.ActiveBackground = Brushes.Transparent;
         }
     }
     else if (e.Property == UpdateFilterFunctionProperty && this._fePopupControl != null)
     {
         this._fePopupControl.UpdateFilterFunction = UpdateFilter;
     }
 }
        public override void OnApplyTemplate()
        {
            DependencyObject fePopup = GetTemplateChild("fePopup");

            if (fePopup != null)
            {
                _fePopup         = fePopup as Popup;
                _fePopup.Opened += new EventHandler(_fePopup_Opened);
                _fePopup.Closed += new EventHandler(_fePopup_Closed);
            }
            var fePopupControl = GetTemplateChild("fePopupControl");

            if (fePopupControl != null)
            {
                _fePopupControl = fePopupControl as FilterEditor;
                if (_collection != null)
                {
                    _fePopupControl.SetCollection(_collection);
                }
                if (FilterExpr != null)
                {
                    _fePopupControl.SetFilter(_collection, FilterExpr);
                }
            }
            this.myWindow = Window.GetWindow(this);
            if (myWindow != null)
            {
                this.myWindow.PreviewMouseDown += new MouseButtonEventHandler(myWindow_PreviewMouseDown);
            }

            if (UpdateFilterFunction != null)
            {
                _fePopupControl.UpdateFilterFunction = UpdateFilter;
            }
            _fePopupControl.SetBinding(FilterEditor.IsReadOnlyProperty, new Binding("IsReadOnly")
            {
                Source = this
            });
        }
        public override void OnApplyTemplate()
        {
            DependencyObject fePopup = GetTemplateChild("fePopup");
            if (fePopup != null)
            {
                _fePopup = fePopup as Popup;
                _fePopup.Opened += new EventHandler(_fePopup_Opened);
                _fePopup.Closed += new EventHandler(_fePopup_Closed);
            }
            var fePopupControl = GetTemplateChild("fePopupControl");
            if (fePopupControl != null)
            {
                _fePopupControl = fePopupControl as FilterEditor;
                if(_collection != null)
                    _fePopupControl.SetCollection(_collection);
                if (FilterExpr != null)
                    _fePopupControl.SetFilter(_collection, FilterExpr);
            }
            this.myWindow = Window.GetWindow(this);
            if(myWindow!=null)
                this.myWindow.PreviewMouseDown += new MouseButtonEventHandler(myWindow_PreviewMouseDown);

            if (UpdateFilterFunction != null)
            {
                _fePopupControl.UpdateFilterFunction = UpdateFilter;
            }
            _fePopupControl.SetBinding(FilterEditor.IsReadOnlyProperty, new Binding("IsReadOnly") { Source = this });
        }