Commits

Михаил Сафонов  committed f0e995e

+ Добавил ColumnFilterCollection

  • Participants
  • Parent commits 6da7280

Comments (0)

Files changed (4)

File DgvFilterPopup.csproj

   </ItemGroup>
   <ItemGroup>
     <Compile Include="FilterPopup\ColumnFilterEvent.cs" />
+    <Compile Include="FilterPopup\ColumnFiltersCollection.cs" />
     <Compile Include="FilterPopup\Extensions\DgvDateRangeColumnFilter.cs">
       <SubType>UserControl</SubType>
     </Compile>
       <DependentUpon>DgvTextBoxColumnFilter.cs</DependentUpon>
     </Compile>
     <Compile Include="Properties\AssemblyInfo.cs" />
-<Compile Include="Resources\LocalizedStrings.Designer.cs">
+    <Compile Include="Resources\LocalizedStrings.Designer.cs">
       <AutoGen>True</AutoGen>
       <DesignTime>True</DesignTime>
       <DependentUpon>LocalizedStrings.resx</DependentUpon>

File FilterPopup/ColumnFiltersCollection.cs

+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace DgvFilterPopup
+{
+    /// <summary>
+    /// </summary>
+    public sealed class ColumnFiltersCollection : System.Collections.ObjectModel.ReadOnlyCollection<DgvBaseColumnFilter>
+    {
+        DgvFilterManager _manager;
+
+        internal ColumnFiltersCollection(IList<DgvBaseColumnFilter> list, DgvFilterManager manager)
+            : base(list)
+        {
+            _manager = manager;
+        }
+
+        
+        public new DgvBaseColumnFilter this[int index]
+        {
+            get
+            {
+                return _manager[index];
+            }
+            set
+            {
+                _manager[index] = value;
+            }
+        }
+
+        public DgvBaseColumnFilter this[string ColumnName]
+        {
+            get
+            {
+                return _manager[ColumnName];
+            }
+            set
+            {
+                _manager[ColumnName] = value;
+            }
+        }
+    }
+}

File FilterPopup/DgvFilterManager.cs

         private int mCurrentColumnIndex = -1;       // Column Index of currently visibile filter
 
         private List<DgvBaseColumnFilter> mColumnFilterList;    // List of ColumnFilter objects
+        private ColumnFiltersCollection mFilterCollection;      // M.S.A [+] read only public collection
         private bool mAutoCreateFilters = true;
         private bool mFilterIsActive = false;
 
         /// </remarks>
         public event ColumnFilterEventHandler PopupShowing;
 
+        /// <summary>
+        /// Occurs when <see cref="DgvFilterManager"/> rebuid and apply new filter
+        /// </summary>
         public event EventHandler FilterChanged;    // M.S.A [+]
 
 
             private set;
         }
 
+        /// <summary>
+        /// Return collection of <see cref="DgvBaseColumnFilter"/>
+        /// </summary>
+        public ColumnFiltersCollection ColumnFilters    // M.S.A [+]
+        {
+            get
+            {
+                return mFilterCollection;
+            }
+        }
+
 
         /// <summary>
         /// Gets and sets the DataGridView to which apply filtering capabilities.
             set {
                 mDataGridView = value;
                 mColumnFilterList = new List<DgvBaseColumnFilter>(mDataGridView.Columns.Count);
+                mFilterCollection = new ColumnFiltersCollection(mColumnFilterList, this); // M.S.A [+]
                 FindDataView();
                 mDataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
                 mDataGridView.CellMouseClick += new DataGridViewCellMouseEventHandler(mDataGridView_CellMouseClick);

File Properties/AssemblyInfo.cs

 //
 // You can specify all the values or you can default the Revision and Build Numbers 
 // by using the '*' as shown below:
-[assembly: AssemblyVersion("1.1.5.0")]
+[assembly: AssemblyVersion("1.1.6.0")]
 [assembly: AssemblyFileVersion("1.0.0.0")]