├── .editorconfig
├── .github
├── FUNDING.yml
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
└── PULL_REQUEST_TEMPLATE
│ └── pull_request_template.md
├── .gitignore
├── Images
├── logo.png
└── logo_gradient.png
├── ObservableView.sln
├── ObservableView
├── Exceptions
│ └── SearchTextPreprocessorException.cs
├── Extensions
│ ├── EnumerableExtensions.cs
│ ├── ExpressionExtensions.cs
│ ├── ObservableViewExtensions.cs
│ ├── OperationExtensions.cs
│ ├── QueryableExtensions.cs
│ ├── ReflectionHelper.cs
│ ├── SortDirectionExtensions.cs
│ ├── StringExtensions.cs
│ └── TypeExtensions.cs
├── Filtering
│ ├── FilterEventArgs.cs
│ └── FilterEventHandler.cs
├── GlobalUsings.cs
├── Grouping
│ ├── AlphaGroupKeyAlgorithm.cs
│ ├── GroupKeyAlgorithm.cs
│ ├── Grouping.cs
│ ├── IGroupKeyAlgorithm.cs
│ └── MonthGroupAlgorithm.cs
├── IObservableView.cs
├── ObservableObject.cs
├── ObservableView.cs
├── ObservableView.csproj
├── PreserveAttribute.cs
├── Properties
│ └── AssemblyInfo.cs
├── SearchLogic.cs
├── Searching
│ ├── ExpressionBuilder.cs
│ ├── IExpressionBuilder.cs
│ ├── ISearchSpecification.cs
│ ├── Operands
│ │ ├── ConstantOperand.cs
│ │ ├── IOperand.cs
│ │ ├── Operand.cs
│ │ ├── Operation.cs
│ │ ├── PropertyOperand.cs
│ │ └── VariableOperand.cs
│ ├── Operations
│ │ ├── BinaryOperation.cs
│ │ └── GroupOperation.cs
│ ├── Operators
│ │ ├── AndOperator.cs
│ │ ├── BinaryOperator.cs
│ │ ├── ContainsOperator.cs
│ │ ├── EqualOperator.cs
│ │ ├── GroupOperator.cs
│ │ ├── IOperator.cs
│ │ └── OrOperator.cs
│ ├── Processors
│ │ ├── ExpressionProcessor.cs
│ │ ├── IExpressionProcessor.cs
│ │ ├── ToLowerExpressionProcessor.cs
│ │ ├── ToUpperExpressionProcessor.cs
│ │ └── TrimExpressionProcessor.cs
│ ├── SearchSpecification.cs
│ └── SearchableAttribute.cs
├── Sorting
│ ├── NaturalSortComparable.cs
│ ├── OrderDirection.cs
│ └── OrderSpecification.cs
└── Utils
│ └── TaskDelayer.cs
├── Readme.md
├── Samples
├── MauiSampleApp
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── MauiProgram.cs
│ ├── MauiSampleApp.csproj
│ ├── Platforms
│ │ ├── Android
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── MainActivity.cs
│ │ │ ├── MainApplication.cs
│ │ │ └── Resources
│ │ │ │ └── values
│ │ │ │ └── colors.xml
│ │ ├── Windows
│ │ │ ├── App.xaml
│ │ │ ├── App.xaml.cs
│ │ │ ├── Package.appxmanifest
│ │ │ └── app.manifest
│ │ └── iOS
│ │ │ ├── AppDelegate.cs
│ │ │ ├── Info.plist
│ │ │ └── Program.cs
│ ├── Properties
│ │ └── launchSettings.json
│ ├── Resources
│ │ ├── AppIcon
│ │ │ ├── appicon.svg
│ │ │ └── appiconfg.svg
│ │ ├── Fonts
│ │ │ ├── OpenSans-Regular.ttf
│ │ │ └── OpenSans-Semibold.ttf
│ │ ├── Images
│ │ │ └── dotnet_bot.png
│ │ ├── Raw
│ │ │ └── AboutAssets.txt
│ │ ├── Splash
│ │ │ └── splash.svg
│ │ └── Styles
│ │ │ ├── Colors.xaml
│ │ │ └── Styles.xaml
│ └── Views
│ │ ├── ItemTemplates
│ │ ├── MallItemTemplate.xaml
│ │ └── MallItemTemplate.xaml.cs
│ │ ├── MainPage.xaml
│ │ └── MainPage.xaml.cs
├── ObservableViewSample
│ ├── Model
│ │ └── Mall.cs
│ ├── ObservableViewSample.csproj
│ ├── Service
│ │ ├── IMallManager.cs
│ │ └── MallManager.cs
│ └── ViewModel
│ │ └── MainViewModel.cs
├── Settings.XamlStyler
└── WpfSampleApp
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── AssemblyInfo.cs
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ ├── ViewModels
│ ├── FilterItemViewModel.cs
│ └── FilterViewModel.cs
│ ├── Views
│ ├── FilterControl.xaml
│ ├── FilterControl.xaml.cs
│ ├── FilterItemView.xaml
│ └── FilterItemView.xaml.cs
│ └── WpfSampleApp.csproj
├── Tests
└── ObservableView.Tests
│ ├── Extensions
│ ├── ExpressionExtensionsTests.cs
│ ├── QueryableExtensionsTests.cs
│ └── StringExtensionsTests.cs
│ ├── GlobalUsings.cs
│ ├── ObservableView.Tests.csproj
│ ├── ObservableViewTests.cs
│ ├── Searching
│ ├── ExpressionBuilderTests.cs
│ ├── Operands
│ │ ├── ConstantOperandTests.cs
│ │ ├── PropertyOperandTests.cs
│ │ └── VariableOperandTests.cs
│ ├── Operators
│ │ ├── ContainsOperatorTests.cs
│ │ └── EqualOperatorTests.cs
│ ├── Processors
│ │ └── ExpressionProcessorTests.cs
│ └── SearchSpecificationTests.cs
│ ├── Sorting
│ └── NaturalSortComparableTests.cs
│ ├── TestData
│ ├── Car.cs
│ ├── CarBrand.cs
│ ├── CarPool.cs
│ ├── Engine.cs
│ ├── FuelType.cs
│ ├── Person.cs
│ └── TestHelper.cs
│ └── TestHelpers
│ └── UseCultureAttribute.cs
├── azure-pipelines.yml
└── clean.bat
/.editorconfig:
--------------------------------------------------------------------------------
1 | ####################################################################
2 | # Editor Configuration (Updated 2023-07-26)
3 | #
4 | # (c)2023 superdev GmbH
5 | ####################################################################
6 |
7 | root = true
8 |
9 | [*.csproj]
10 | indent_style = space
11 | indent_size = 2
12 | tab_width = 2
13 |
14 | [*.cs]
15 | indent_style = space
16 | indent_size = 4
17 | tab_width = 4
18 | end_of_line = crlf
19 | trim_trailing_whitespace = true
20 | insert_final_newline = false
21 | max_line_length = 140
22 |
23 | csharp_indent_block_contents = true
24 | csharp_indent_braces = false
25 | csharp_indent_case_contents = true
26 | csharp_indent_labels = one_less_than_current
27 | csharp_indent_switch_labels = true
28 |
29 | csharp_new_line_before_catch = true
30 | csharp_new_line_before_else = true
31 | csharp_new_line_before_finally = true
32 | csharp_new_line_before_members_in_anonymous_types = true
33 | csharp_new_line_before_members_in_object_initializers = true
34 | csharp_new_line_before_open_brace = all
35 | csharp_new_line_between_query_expression_clauses = true
36 |
37 | csharp_prefer_braces = true:error
38 | csharp_prefer_simple_default_expression = true:error
39 | csharp_prefer_simple_using_statement = false:silent
40 |
41 | csharp_using_directive_placement = outside_namespace:silent
42 | csharp_preserve_single_line_blocks = true
43 | csharp_preserve_single_line_statements = true
44 |
45 | csharp_space_after_cast = false
46 | csharp_space_after_colon_in_inheritance_clause = true
47 | csharp_space_after_comma = true
48 | csharp_space_after_dot = false
49 | csharp_space_after_keywords_in_control_flow_statements = true
50 | csharp_space_after_semicolon_in_for_statement = true
51 | csharp_space_around_binary_operators = before_and_after
52 | csharp_space_around_declaration_statements = do_not_ignore
53 | csharp_space_before_colon_in_inheritance_clause = true
54 | csharp_space_before_comma = false
55 | csharp_space_before_dot = false
56 | csharp_space_before_open_square_brackets = false
57 | csharp_space_before_semicolon_in_for_statement = false
58 | csharp_space_between_empty_square_brackets = false
59 | csharp_space_between_method_call_empty_parameter_list_parentheses = false
60 | csharp_space_between_method_call_name_and_opening_parenthesis = false
61 | csharp_space_between_method_call_parameter_list_parentheses = false
62 | csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
63 | csharp_space_between_method_declaration_name_and_open_parenthesis = false
64 | csharp_space_between_method_declaration_parameter_list_parentheses = false
65 | csharp_space_between_parentheses = none
66 | csharp_space_between_square_brackets = false
67 |
68 | # Expression-bodied members
69 | csharp_style_expression_bodied_accessors = true:none
70 | csharp_style_expression_bodied_constructors = false:none
71 | csharp_style_expression_bodied_indexers = true:none
72 | csharp_style_expression_bodied_lambdas = true:none
73 | csharp_style_expression_bodied_local_functions = false:silent
74 | csharp_style_expression_bodied_methods = false:none
75 | csharp_style_expression_bodied_operators = false:none
76 | csharp_style_expression_bodied_properties = true:silent
77 |
78 | csharp_style_conditional_delegate_call = true:error
79 | csharp_style_inlined_variable_declaration = true:error
80 | csharp_style_pattern_matching_over_as_with_null_check = true:error
81 | csharp_style_pattern_matching_over_is_with_cast_check = true:error
82 | csharp_style_throw_expression = true:suggestion
83 | csharp_style_var_elsewhere = true:suggestion
84 | csharp_style_var_for_built_in_types = true:suggestion
85 | csharp_style_var_when_type_is_apparent = true:error
86 | csharp_style_implicit_object_creation_when_type_is_apparent = false
87 | csharp_style_prefer_switch_expression = false
88 | csharp_style_namespace_declarations = block_scoped:silent
89 | csharp_style_prefer_method_group_conversion = true:silent
90 | csharp_style_prefer_top_level_statements = true:silent
91 | csharp_style_prefer_null_check_over_type_check = true:suggestion
92 |
93 | dotnet_sort_system_directives_first = true
94 | dotnet_style_coalesce_expression = true:suggestion
95 | dotnet_style_collection_initializer = true:error
96 | dotnet_style_explicit_tuple_names = true:error
97 | dotnet_style_null_propagation = true:error
98 | dotnet_style_object_initializer = true:none
99 | dotnet_style_predefined_type_for_locals_parameters_members = true:error
100 | dotnet_style_predefined_type_for_member_access = true:error
101 |
102 | dotnet_style_qualification_for_event = true:error
103 | dotnet_style_qualification_for_field = true:error
104 | dotnet_style_qualification_for_method = true:error
105 | dotnet_style_qualification_for_property = true:error
106 | dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
107 | dotnet_style_prefer_auto_properties = true:silent
108 | dotnet_style_prefer_simplified_boolean_expressions = false:suggestion
109 | dotnet_style_prefer_conditional_expression_over_assignment = false:suggestion
110 | dotnet_style_prefer_conditional_expression_over_return = false:suggestion
111 | dotnet_style_prefer_inferred_tuple_names = true:suggestion
112 | dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
113 | dotnet_style_prefer_compound_assignment = true:suggestion
114 | dotnet_style_prefer_simplified_interpolation = true:suggestion
115 | dotnet_style_namespace_match_folder = true:suggestion
116 | dotnet_style_operator_placement_when_wrapping = beginning_of_line
117 | csharp_style_unused_value_expression_statement_preference = discard_variable:none
118 | csharp_style_unused_value_assignment_preference = discard_variable:none
119 | csharp_style_prefer_method_group_conversion = true
120 |
121 | dotnet_naming_symbols.private_field_symbol.applicable_kinds = field
122 | dotnet_naming_symbols.private_field_symbol.applicable_accessibilities = private
123 | dotnet_naming_style.private_field_style.capitalization = camel_case
124 | dotnet_naming_rule.private_fields_are_camel_case.severity = error
125 | dotnet_naming_rule.private_fields_are_camel_case.symbols = private_field_symbol
126 | dotnet_naming_rule.private_fields_are_camel_case.style = private_field_style
127 |
128 | dotnet_naming_symbols.non_private_field_symbol.applicable_kinds = field
129 | dotnet_naming_symbols.non_private_field_symbol.applicable_accessibilities = public,internal,friend,protected,protected_internal,protected_friend
130 | dotnet_naming_style.non_private_field_style.capitalization = pascal_case
131 | dotnet_naming_rule.non_private_fields_are_pascal_case.severity = error
132 | dotnet_naming_rule.non_private_fields_are_pascal_case.symbols = non_private_field_symbol
133 | dotnet_naming_rule.non_private_fields_are_pascal_case.style = non_private_field_style
134 |
135 | dotnet_naming_symbols.parameter_symbol.applicable_kinds = parameter
136 | dotnet_naming_style.parameter_style.capitalization = camel_case
137 | dotnet_naming_rule.parameters_are_camel_case.severity = error
138 | dotnet_naming_rule.parameters_are_camel_case.symbols = parameter_symbol
139 | dotnet_naming_rule.parameters_are_camel_case.style = private_field_style
140 |
141 | dotnet_naming_symbols.non_interface_type_symbol.applicable_kinds = class,struct,enum,delegate
142 | dotnet_naming_style.non_interface_type_style.capitalization = pascal_case
143 | dotnet_naming_rule.non_interface_types_are_pascal_case.severity = error
144 | dotnet_naming_rule.non_interface_types_are_pascal_case.symbols = non_interface_type_symbol
145 | dotnet_naming_rule.non_interface_types_are_pascal_case.style = non_private_field_style
146 |
147 | dotnet_naming_symbols.interface_type_symbol.applicable_kinds = interface
148 | dotnet_naming_style.interface_type_style.capitalization = pascal_case
149 | dotnet_naming_style.interface_type_style.required_prefix = I
150 | dotnet_naming_rule.interface_types_must_be_prefixed_with_I.severity = error
151 | dotnet_naming_rule.interface_types_must_be_prefixed_with_I.symbols = interface_type_symbol
152 | dotnet_naming_rule.interface_types_must_be_prefixed_with_I.style = interface_type_style
153 |
154 | dotnet_naming_symbols.member_symbol.applicable_kinds = method,property,event
155 | dotnet_naming_style.member_style.capitalization = pascal_case
156 | dotnet_naming_rule.members_are_pascal_case.severity = error
157 | dotnet_naming_rule.members_are_pascal_case.symbols = member_symbol
158 | dotnet_naming_rule.members_are_pascal_case.style = non_private_field_style
159 |
160 | dotnet_naming_rule.static_fields_should_be_pascal_case.severity = suggestion
161 | dotnet_naming_rule.static_fields_should_be_pascal_case.symbols = static_fields
162 | dotnet_naming_rule.static_fields_should_be_pascal_case.style = non_private_field_style
163 | dotnet_naming_symbols.static_fields.applicable_kinds = field
164 | dotnet_naming_symbols.static_fields.applicable_accessibilities = *
165 | dotnet_naming_symbols.static_fields.required_modifiers = static
166 | dotnet_naming_style.static_field_style.capitalization = pascal_case
167 |
168 | # CS4014: Because this call is not awaited, execution of the current method continues before the call is completed
169 | dotnet_diagnostic.CS4014.severity = error
170 |
171 | # IDE0051: Remove unused private members
172 | dotnet_diagnostic.IDE0051.severity = warning
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | patreon: user?u=21232884
2 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: "[Bug]"
5 | labels: bug
6 | assignees: ''
7 |
8 | ---
9 |
10 | ### Description
11 |
12 | ### Steps to Reproduce
13 |
14 | 1.
15 | 2.
16 | 3.
17 |
18 | ### Expected Behavior
19 | -
20 |
21 | ### Actual Behavior
22 | -
23 |
24 | ### Basic Information
25 |
26 | - Version with issue:
27 | - Last known good version:
28 |
29 | ### Screenshots
30 |
31 |
32 |
33 | ### Reproduction Link
34 |
35 |
36 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: "[Enhancement]"
5 | labels: enhancement
6 | assignees: ''
7 |
8 | ---
9 |
10 | ## Summary
11 | Please provide a brief summary of your proposal. Two to three sentences is best here.
12 |
13 | ## API Changes
14 | Include a list of all API changes, additions, subtractions as would be required by your proposal.
15 |
16 | e.g.
17 |
18 | In order for my new feature to be awesome, we need to create a new boolean value to indicate that it is awesome.
19 |
20 | ```csharp
21 | var myapi = new AwesomeApi();
22 | myapi.beAwesome = true;
23 | ```
24 |
25 | ## Intended Use Case
26 | Provide a detailed example of where your proposal would be used and for what purpose.
27 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md:
--------------------------------------------------------------------------------
1 | ## Added / Fixed
2 |
3 | - Added a new feature
4 | - Fixed a bug
5 |
6 | ## Todo List
7 |
8 | - [ ] I have reviewed my changes
9 | - [ ] I have added unit tests
10 | - [ ] I have documented public APIs
11 |
12 | >*Todo list can be checked by putting a `X` inside the brackets*
13 |
14 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | artifacts/
46 |
47 | *_i.c
48 | *_p.c
49 | *_i.h
50 | *.ilk
51 | *.meta
52 | *.obj
53 | *.pch
54 | *.pdb
55 | *.pgc
56 | *.pgd
57 | *.rsp
58 | *.sbr
59 | *.tlb
60 | *.tli
61 | *.tlh
62 | *.tmp
63 | *.tmp_proj
64 | *.log
65 | *.vspscc
66 | *.vssscc
67 | .builds
68 | *.pidb
69 | *.svclog
70 | *.scc
71 |
72 | # Chutzpah Test files
73 | _Chutzpah*
74 |
75 | # Visual C++ cache files
76 | ipch/
77 | *.aps
78 | *.ncb
79 | *.opendb
80 | *.opensdf
81 | *.sdf
82 | *.cachefile
83 | *.VC.db
84 | *.VC.VC.opendb
85 |
86 | # Visual Studio profiler
87 | *.psess
88 | *.vsp
89 | *.vspx
90 | *.sap
91 |
92 | # TFS 2012 Local Workspace
93 | $tf/
94 |
95 | # Guidance Automation Toolkit
96 | *.gpState
97 |
98 | # ReSharper is a .NET coding add-in
99 | _ReSharper*/
100 | *.[Rr]e[Ss]harper
101 | *.DotSettings.user
102 |
103 | # JustCode is a .NET coding add-in
104 | .JustCode
105 |
106 | # TeamCity is a build add-in
107 | _TeamCity*
108 |
109 | # DotCover is a Code Coverage Tool
110 | *.dotCover
111 |
112 | # NCrunch
113 | _NCrunch_*
114 | .*crunch*.local.xml
115 | nCrunchTemp_*
116 |
117 | # MightyMoose
118 | *.mm.*
119 | AutoTest.Net/
120 |
121 | # Web workbench (sass)
122 | .sass-cache/
123 |
124 | # Installshield output folder
125 | [Ee]xpress/
126 |
127 | # DocProject is a documentation generator add-in
128 | DocProject/buildhelp/
129 | DocProject/Help/*.HxT
130 | DocProject/Help/*.HxC
131 | DocProject/Help/*.hhc
132 | DocProject/Help/*.hhk
133 | DocProject/Help/*.hhp
134 | DocProject/Help/Html2
135 | DocProject/Help/html
136 |
137 | # Click-Once directory
138 | publish/
139 |
140 | # Publish Web Output
141 | *.[Pp]ublish.xml
142 | *.azurePubxml
143 | # TODO: Comment the next line if you want to checkin your web deploy settings
144 | # but database connection strings (with potential passwords) will be unencrypted
145 | *.pubxml
146 | *.publishproj
147 |
148 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
149 | # checkin your Azure Web App publish settings, but sensitive information contained
150 | # in these scripts will be unencrypted
151 | PublishScripts/
152 |
153 | # NuGet Packages
154 | *.nupkg
155 | # The packages folder can be ignored because of Package Restore
156 | **/packages/*
157 | # except build/, which is used as an MSBuild target.
158 | !**/packages/build/
159 | # Uncomment if necessary however generally it will be regenerated when needed
160 | #!**/packages/repositories.config
161 | # NuGet v3's project.json files produces more ignoreable files
162 | *.nuget.props
163 | *.nuget.targets
164 |
165 | # Microsoft Azure Build Output
166 | csx/
167 | *.build.csdef
168 |
169 | # Microsoft Azure Emulator
170 | ecf/
171 | rcf/
172 |
173 | # Windows Store app package directories and files
174 | AppPackages/
175 | BundleArtifacts/
176 | Package.StoreAssociation.xml
177 | _pkginfo.txt
178 |
179 | # Visual Studio cache files
180 | # files ending in .cache can be ignored
181 | *.[Cc]ache
182 | # but keep track of directories ending in .cache
183 | !*.[Cc]ache/
184 |
185 | # Others
186 | ClientBin/
187 | ~$*
188 | *~
189 | *.dbmdl
190 | *.dbproj.schemaview
191 | *.pfx
192 | *.publishsettings
193 | node_modules/
194 | orleans.codegen.cs
195 |
196 | # Since there are multiple workflows, uncomment next line to ignore bower_components
197 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
198 | #bower_components/
199 |
200 | # RIA/Silverlight projects
201 | Generated_Code/
202 |
203 | # Backup & report files from converting an old project file
204 | # to a newer Visual Studio version. Backup files are not needed,
205 | # because we have git ;-)
206 | _UpgradeReport_Files/
207 | Backup*/
208 | UpgradeLog*.XML
209 | UpgradeLog*.htm
210 |
211 | # SQL Server files
212 | *.mdf
213 | *.ldf
214 |
215 | # Business Intelligence projects
216 | *.rdl.data
217 | *.bim.layout
218 | *.bim_*.settings
219 |
220 | # Microsoft Fakes
221 | FakesAssemblies/
222 |
223 | # GhostDoc plugin setting file
224 | *.GhostDoc.xml
225 |
226 | # Node.js Tools for Visual Studio
227 | .ntvs_analysis.dat
228 |
229 | # Visual Studio 6 build log
230 | *.plg
231 |
232 | # Visual Studio 6 workspace options file
233 | *.opt
234 |
235 | # Visual Studio LightSwitch build output
236 | **/*.HTMLClient/GeneratedArtifacts
237 | **/*.DesktopClient/GeneratedArtifacts
238 | **/*.DesktopClient/ModelManifest.xml
239 | **/*.Server/GeneratedArtifacts
240 | **/*.Server/ModelManifest.xml
241 | _Pvt_Extensions
242 |
243 | # Paket dependency manager
244 | .paket/paket.exe
245 | paket-files/
246 |
247 | # FAKE - F# Make
248 | .fake/
249 |
250 | # JetBrains Rider
251 | .idea/
252 | *.sln.iml
253 | *.bak
254 | *.p8
255 | *.p12
256 |
257 | # Firebase config files
258 | **/GoogleService-Info.plist
259 | **/google-services.json
260 |
--------------------------------------------------------------------------------
/Images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thomasgalliker/ObservableView/ee3f72dbf0384bd052755cb16f524bde95486167/Images/logo.png
--------------------------------------------------------------------------------
/Images/logo_gradient.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/thomasgalliker/ObservableView/ee3f72dbf0384bd052755cb16f524bde95486167/Images/logo_gradient.png
--------------------------------------------------------------------------------
/ObservableView/Exceptions/SearchTextPreprocessorException.cs:
--------------------------------------------------------------------------------
1 | namespace ObservableView.Exceptions
2 | {
3 | public class SearchTextPreprocessorException : Exception
4 | {
5 | public SearchTextPreprocessorException(string message, Exception innerException)
6 | : base(message, innerException)
7 | {
8 | }
9 | }
10 | }
--------------------------------------------------------------------------------
/ObservableView/Extensions/EnumerableExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace ObservableView.Extensions
2 | {
3 | public static class EnumerableExtensions
4 | {
5 | ///
6 | /// To the observable collection.
7 | ///
8 | /// Generic type T.
9 | /// The enumerable.
10 | /// The resulting ObservableCollection<T>.
11 | public static ObservableCollection ToObservableCollection(this IEnumerable enumerable)
12 | {
13 | return new ObservableCollection(enumerable);
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/ObservableView/Extensions/ExpressionExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace ObservableView.Extensions
2 | {
3 | public static class ExpressionExtensions
4 | {
5 | public static Expression ToLower(this Expression expression)
6 | {
7 | EnsureToString(ref expression);
8 |
9 | var methodInfo = ReflectionHelper.GetMethod(source => source.ToLower());
10 | var toLowerExpression = Expression.Call(expression, methodInfo);
11 |
12 | expression = IsNotNull(expression, toLowerExpression);
13 | return expression;
14 | }
15 |
16 | public static Expression ToUpper(this Expression expression)
17 | {
18 | EnsureToString(ref expression);
19 |
20 | var methodInfo = ReflectionHelper.GetMethod(source => source.ToUpper());
21 | var toUpperExpression = Expression.Call(expression, methodInfo);
22 |
23 | expression = IsNotNull(expression, toUpperExpression);
24 | return expression;
25 | }
26 |
27 | public static Expression Trim(this Expression expression)
28 | {
29 | EnsureToString(ref expression);
30 |
31 | var methodInfo = ReflectionHelper.GetMethod(source => source.Trim());
32 | var trimExpression = Expression.Call(expression, methodInfo);
33 |
34 | expression = IsNotNull(expression, trimExpression);
35 | return expression;
36 | }
37 |
38 | public static Expression ToStringExpression(this Expression expression)
39 | {
40 | var methodInfo = ReflectionHelper.GetMethod(source => source.ToString());
41 | return Expression.Call(expression, methodInfo);
42 | }
43 |
44 | private static void EnsureToString(ref Expression expression)
45 | {
46 | if (expression.Type != typeof(string))
47 | {
48 | expression = expression.ToStringExpression();
49 | }
50 | }
51 |
52 | public static Expression IsNotNull(this Expression checkExpression, Expression expressionIfNotNull)
53 | {
54 | var expression = Expression.Condition(
55 | Expression.NotEqual(checkExpression, Expression.Constant(null, checkExpression.Type)),
56 | expressionIfNotNull,
57 | Expression.Constant(string.Empty));
58 |
59 | return expression;
60 | }
61 | }
62 | }
--------------------------------------------------------------------------------
/ObservableView/Extensions/ObservableViewExtensions.cs:
--------------------------------------------------------------------------------
1 | #if NETFRAMEWORK
2 | using System;
3 | using System.Collections.Specialized;
4 | using System.ComponentModel;
5 | using System.Linq;
6 |
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using ObservableView.Sorting;
11 |
12 | namespace ObservableView.Extensions
13 | {
14 | public static class ObservableViewExtensions
15 | {
16 | private static DataGrid dataGrid;
17 |
18 | public static readonly DependencyProperty ObservableViewProperty = DependencyProperty.RegisterAttached(
19 | "ObservableView",
20 | typeof(object),
21 | typeof(ObservableViewExtensions),
22 | new UIPropertyMetadata(null, ObservableViewPropertyChanged));
23 |
24 | public static object GetObservableView(DependencyObject obj)
25 | {
26 | return obj.GetValue(ObservableViewProperty);
27 | }
28 |
29 | public static void SetObservableView(DependencyObject obj, object value)
30 | {
31 | obj.SetValue(ObservableViewProperty, value);
32 | }
33 |
34 | private static void ObservableViewPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
35 | {
36 | dataGrid = d as DataGrid;
37 | if (dataGrid == null)
38 | {
39 | return;
40 | }
41 |
42 | if (e.OldValue is IObservableView oldObservableView)
43 | {
44 | dataGrid.Loaded -= DataGridLoaded;
45 | dataGrid.Unloaded -= DataGridUnloaded;
46 | }
47 |
48 | if (e.NewValue is IObservableView newObservableView)
49 | {
50 | dataGrid.Loaded += DataGridLoaded;
51 | dataGrid.Unloaded += DataGridUnloaded;
52 |
53 | CheckIfItemsSourcePropertyIsNotBound();
54 | BindObservableViewToItemsSource();
55 | }
56 | }
57 |
58 | static void SortDescriptionCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
59 | {
60 | Console.WriteLine("SortDescriptionCollectionChanged: Action={0}", e.Action);
61 |
62 | if (dataGrid == null)
63 | {
64 | return;
65 | }
66 |
67 | if (GetObservableView(dataGrid) is not IObservableView observableView)
68 | {
69 | return;
70 | }
71 |
72 | if (e.Action == NotifyCollectionChangedAction.Reset)
73 | {
74 | // clear all columns sort directions
75 | foreach (var column in dataGrid.Columns)
76 | {
77 | column.SortDirection = null;
78 | }
79 | }
80 |
81 | if (e.NewItems != null)
82 | {
83 | observableView.ClearOrderSpecifications();
84 | var allSortDescriptions = (SortDescriptionCollection)sender;
85 |
86 | // set columns sort directions
87 | var sortDescriptions = allSortDescriptions.Union(e.NewItems.Cast()).ToList();
88 | foreach (SortDescription sortDescription in sortDescriptions) //TODO GATH NewItems only contains NEW ITEMS; We should also consider existing sort orders
89 | {
90 |
91 | var orderDirection = sortDescription.Direction == ListSortDirection.Ascending ? OrderDirection.Ascending : OrderDirection.Descending;
92 | observableView.AddOrderSpecification(sortDescription.PropertyName, orderDirection);
93 |
94 | SetSortDirection(sortDescription.PropertyName, sortDescription.Direction);
95 | }
96 | }
97 |
98 | if (e.OldItems != null)
99 | {
100 | // reset columns sort directions
101 | foreach (SortDescription descr in e.OldItems)
102 | {
103 | observableView.RemoveOrderSpecification(descr.PropertyName);
104 | SetSortDirection(descr.PropertyName, null);
105 | }
106 | }
107 | }
108 |
109 | private static void SetSortDirection(string sortMemberPath, ListSortDirection? direction)
110 | {
111 | var column = dataGrid.Columns.FirstOrDefault(c => c.SortMemberPath == sortMemberPath);
112 | if (column != null)
113 | {
114 | column.SortDirection = direction;
115 | }
116 | }
117 |
118 | ///
119 | /// Check if there is a binding to ItemsSource.
120 | /// If you use the ObservableView dependency property, you must use ItemsSource at the same time.
121 | ///
122 | private static void CheckIfItemsSourcePropertyIsNotBound()
123 | {
124 | var itemsSourceBindingExpression = dataGrid.GetBindingExpression(ItemsControl.ItemsSourceProperty);
125 | if (itemsSourceBindingExpression != null)
126 | {
127 | throw new InvalidOperationException("Dependency property 'ItemsSource' must not have a binding for ObservableView to work properly. " +
128 | "Bind to ObservableView instead.");
129 | }
130 | }
131 |
132 | ///
133 | /// Since we want to bind the ObservableView directly to the ObservableViewProperty,
134 | /// we have to make sure that the ItemsSourceProperty of the DataGrid is bound programmatically to the ObservableView.View property.
135 | ///
136 | private static void BindObservableViewToItemsSource()
137 | {
138 | var observableViewBindingExpression = dataGrid.GetBindingExpression(ObservableViewProperty);
139 | if (observableViewBindingExpression == null)
140 | {
141 | throw new InvalidOperationException("Dependency property 'ObservableView' does not have a valid binding.");
142 | }
143 |
144 | string viewPropertyBindingName = observableViewBindingExpression.ResolvedSourcePropertyName + ".View";
145 | var viewPropertyBinding = new Binding(viewPropertyBindingName);
146 | dataGrid.SetBinding(ItemsControl.ItemsSourceProperty, viewPropertyBinding);
147 | }
148 |
149 | private static void DataGridUnloaded(object sender, RoutedEventArgs e)
150 | {
151 | if (dataGrid == null)
152 | {
153 | return;
154 | }
155 |
156 | if (dataGrid.Items.SortDescriptions is INotifyCollectionChanged notifyCollectionChanged)
157 | {
158 | notifyCollectionChanged.CollectionChanged -= SortDescriptionCollectionChanged;
159 | }
160 |
161 | if (GetObservableView(dataGrid) is not IObservableView observableView)
162 | {
163 | return;
164 | }
165 |
166 | observableView.PropertyChanged -= ObservableViewOnPropertyChanged;
167 | }
168 |
169 | private static void DataGridLoaded(object sender, RoutedEventArgs e)
170 | {
171 | if (dataGrid == null)
172 | {
173 | return;
174 | }
175 |
176 | if (GetObservableView(dataGrid) is not IObservableView observableView)
177 | {
178 | return;
179 | }
180 |
181 | observableView.PropertyChanged += ObservableViewOnPropertyChanged;
182 |
183 | // initial sync
184 | SyncObservableViewSortWithDataGridSort(observableView, isInitialSync: true);
185 |
186 | // Subscribe column sort changed
187 | if (dataGrid.Items.SortDescriptions is INotifyCollectionChanged notifyCollectionChanged)
188 | {
189 | notifyCollectionChanged.CollectionChanged += SortDescriptionCollectionChanged;
190 | }
191 | }
192 |
193 | private static void ObservableViewOnPropertyChanged(object sender, PropertyChangedEventArgs args)
194 | {
195 | if (args.PropertyName == "View")
196 | {
197 | if (sender is not IObservableView observableView)
198 | {
199 | return;
200 | }
201 |
202 | SyncObservableViewSortWithDataGridSort(observableView);
203 | }
204 | }
205 |
206 | ///
207 | /// This method is used to synchronize the ObservableView's sort specification
208 | /// with the DataGrid's sort specification.
209 | /// This is the case if the ObservableView refreshes its data.
210 | /// (For some mysterious reasons, the DataGrid loses its sort specification in this case)
211 | ///
212 | private static void SyncObservableViewSortWithDataGridSort(IObservableView observableView, bool isInitialSync = false)
213 | {
214 | Console.WriteLine("Sync ObservableView => DataGrid");
215 |
216 | if (isInitialSync)
217 | {
218 | dataGrid.Items.SortDescriptions.Clear();
219 | }
220 |
221 | foreach (var dataGridColumn in dataGrid.Columns)
222 | {
223 | var listSortDirection = observableView.GetSortSpecification(dataGridColumn.SortMemberPath).ToSortDirection();
224 | if (listSortDirection != null)
225 | {
226 | dataGridColumn.SortDirection = listSortDirection;
227 | if (isInitialSync)
228 | {
229 | dataGrid.Items.SortDescriptions.Add(new SortDescription(dataGridColumn.SortMemberPath, listSortDirection.Value));
230 | }
231 | }
232 | }
233 | }
234 | }
235 | }
236 | #endif
--------------------------------------------------------------------------------
/ObservableView/Extensions/OperationExtensions.cs:
--------------------------------------------------------------------------------
1 | using ObservableView.Searching.Operands;
2 | using ObservableView.Searching.Operations;
3 |
4 | namespace ObservableView.Extensions
5 | {
6 | internal static class OperationExtensions
7 | {
8 | internal static IEnumerable