private void OnFilterApplied(object source, PropertyFilterAppliedEventArgs args) { // If the filter just switched between empty and non-empty if (args.Filter.IsEmpty && this.filterIsEmpty != FilterState.Empty || !args.Filter.IsEmpty && this.filterIsEmpty != FilterState.NotEmpty) { // If the filter is now empty if (args.Filter.IsEmpty) { if (this.haveCachedExpanded) { // Set Pinned and Expanded to what they were before the filter this.Expanded = this.wasExpandedBeforeFilter; this.AdvancedSectionPinned = this.wasAdvancedPinnedBeforeFilter; } } else { // Cache the Pinned and Expanded state this.haveCachedExpanded = true; this.wasExpandedBeforeFilter = this.Expanded; this.wasAdvancedPinnedBeforeFilter = this.AdvancedSectionPinned; } } if (!args.Filter.IsEmpty) { this.Expanded = this.BasicPropertyMatchesFilter || this.AdvancedPropertyMatchesFilter; this.AdvancedSectionPinned = this.AdvancedPropertyMatchesFilter; } this.filterIsEmpty = args.Filter.IsEmpty ? FilterState.Empty : FilterState.NotEmpty; }
public void ShouldInitializeFilter() { PropertyFilter filter = new PropertyFilter("test"); PropertyFilterAppliedEventArgs args = new PropertyFilterAppliedEventArgs(filter); Assert.AreEqual <PropertyFilter>(filter, args.Filter); }
private void OnFilterApplied(object source, PropertyFilterAppliedEventArgs args) { if (args.get_Filter().get_IsEmpty() && this.filterIsEmpty != CategoryContainer.FilterState.Empty || !args.get_Filter().get_IsEmpty() && this.filterIsEmpty != CategoryContainer.FilterState.NotEmpty) { if (args.get_Filter().get_IsEmpty()) { if (this.haveCachedExpanded) { this.Category.Expanded = this.wasExpandedBeforeFilter; this.AdvancedSectionPinned = this.wasAdvancedPinnedBeforeFilter; } } else { this.haveCachedExpanded = true; this.wasExpandedBeforeFilter = this.Category.Expanded; this.wasAdvancedPinnedBeforeFilter = this.AdvancedSectionPinned; } } if (!args.get_Filter().get_IsEmpty()) { this.Category.Expanded = this.BasicPropertyMatchesFilter || this.AdvancedPropertyMatchesFilter; this.AdvancedSectionPinned = this.AdvancedPropertyMatchesFilter; } this.filterIsEmpty = args.get_Filter().get_IsEmpty() ? CategoryContainer.FilterState.Empty : CategoryContainer.FilterState.NotEmpty; }