├── .gitattributes ├── .gitignore ├── DateRangeControl.licenseheader ├── DateRangeControl.sln ├── LICENSE.txt ├── README.md ├── Rh.DateRange.Picker.Examples ├── App.xaml ├── App.xaml.cs ├── MainWindow.xaml ├── MainWindow.xaml.cs ├── ObjectDataProviders.xaml ├── OrientationToIsCheckedConverter.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── RegularControlStyles.xaml ├── Rh.DateRange.Picker.Examples.csproj ├── SampleCustomStyles.xaml ├── SelectedDateFormatToIsCheckedConverter.cs ├── StyleToIsCheckedConverter.cs └── ViewModel │ ├── ExampleViewModel.cs │ └── RelayCommand.cs ├── Rh.DateRange.Picker.Tests ├── DateRangeHelperTests.cs ├── DateRangePickerTests.cs ├── Properties │ └── AssemblyInfo.cs ├── RangeCustomTests.cs ├── Rh.DateRange.Picker.Tests.csproj └── packages.config ├── Rh.DateRange.Picker ├── BuildNugetPackage.cmd ├── Common │ ├── DateRangeChangedEventArgs.cs │ ├── DateRangeExtensions.cs │ ├── DateRangeHelper.cs │ ├── DateRangeKind.cs │ ├── DateRangeList.cs │ ├── DateTimeExtensions.cs │ ├── IDateRange.cs │ ├── RangeCustom.cs │ ├── RangeDay.cs │ ├── RangeFirstDayOfWeekAware.cs │ ├── RangeLast30Days.cs │ ├── RangeLast7Days.cs │ ├── RangeLastMonth.cs │ ├── RangeLastWeek.cs │ ├── RangeLastYear.cs │ ├── RangeMonth.cs │ ├── RangeMonthToDate.cs │ ├── RangePresenter.cs │ ├── RangeTheLastYear.cs │ ├── RangeWeek.cs │ ├── RangeWeekToDate.cs │ ├── RangeYear.cs │ ├── RangeYearToDate.cs │ └── RangeYesterday.cs ├── DateRangePicker.cs ├── DateRangeValue.cs ├── FirstDayOfWeekProvider.cs ├── IFirstDayOfWeekProvider.cs ├── OrientationToSpacerSizeConverter.cs ├── OrientationToTextAlignmentConverter.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Resources.ru-RU.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── Resources │ ├── Resource.Designer.cs │ ├── Resource.de.resx │ ├── Resource.es.resx │ ├── Resource.fr.resx │ ├── Resource.it.resx │ ├── Resource.pl.resx │ ├── Resource.pt.resx │ ├── Resource.resx │ └── Resource.ru.resx ├── Rh.DateRange.Picker.csproj ├── Rh.DateRange.Picker.nuspec └── Themes │ └── Generic.xaml └── docs ├── DateRangePickerHorizontal.png └── DateRangePickerVertical.png /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.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 | [Xx]64/ 19 | [Xx]86/ 20 | [Bb]uild/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 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 | 85 | # Visual Studio profiler 86 | *.psess 87 | *.vsp 88 | *.vspx 89 | *.sap 90 | 91 | # TFS 2012 Local Workspace 92 | $tf/ 93 | 94 | # Guidance Automation Toolkit 95 | *.gpState 96 | 97 | # ReSharper is a .NET coding add-in 98 | _ReSharper*/ 99 | *.[Rr]e[Ss]harper 100 | *.DotSettings.user 101 | 102 | # JustCode is a .NET coding add-in 103 | .JustCode 104 | 105 | # TeamCity is a build add-in 106 | _TeamCity* 107 | 108 | # DotCover is a Code Coverage Tool 109 | *.dotCover 110 | 111 | # NCrunch 112 | _NCrunch_* 113 | .*crunch*.local.xml 114 | nCrunchTemp_* 115 | 116 | # MightyMoose 117 | *.mm.* 118 | AutoTest.Net/ 119 | 120 | # Web workbench (sass) 121 | .sass-cache/ 122 | 123 | # Installshield output folder 124 | [Ee]xpress/ 125 | 126 | # DocProject is a documentation generator add-in 127 | DocProject/buildhelp/ 128 | DocProject/Help/*.HxT 129 | DocProject/Help/*.HxC 130 | DocProject/Help/*.hhc 131 | DocProject/Help/*.hhk 132 | DocProject/Help/*.hhp 133 | DocProject/Help/Html2 134 | DocProject/Help/html 135 | 136 | # Click-Once directory 137 | publish/ 138 | 139 | # Publish Web Output 140 | *.[Pp]ublish.xml 141 | *.azurePubxml 142 | 143 | # TODO: Un-comment the next line if you do not want to checkin 144 | # your web deploy settings because they may include unencrypted 145 | # passwords 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # NuGet Packages 150 | *.nupkg 151 | # The packages folder can be ignored because of Package Restore 152 | **/packages/* 153 | # except build/, which is used as an MSBuild target. 154 | !**/packages/build/ 155 | # Uncomment if necessary however generally it will be regenerated when needed 156 | #!**/packages/repositories.config 157 | # NuGet v3's project.json files produces more ignoreable files 158 | *.nuget.props 159 | *.nuget.targets 160 | 161 | # Microsoft Azure Build Output 162 | csx/ 163 | *.build.csdef 164 | 165 | # Microsoft Azure Emulator 166 | ecf/ 167 | rcf/ 168 | 169 | # Windows Store app package directory 170 | AppPackages/ 171 | BundleArtifacts/ 172 | 173 | # Visual Studio cache files 174 | # files ending in .cache can be ignored 175 | *.[Cc]ache 176 | # but keep track of directories ending in .cache 177 | !*.[Cc]ache/ 178 | 179 | # Others 180 | ClientBin/ 181 | [Ss]tyle[Cc]op.* 182 | ~$* 183 | *~ 184 | *.dbmdl 185 | *.dbproj.schemaview 186 | *.pfx 187 | *.publishsettings 188 | node_modules/ 189 | orleans.codegen.cs 190 | 191 | # RIA/Silverlight projects 192 | Generated_Code/ 193 | 194 | # Backup & report files from converting an old project file 195 | # to a newer Visual Studio version. Backup files are not needed, 196 | # because we have git ;-) 197 | _UpgradeReport_Files/ 198 | Backup*/ 199 | UpgradeLog*.XML 200 | UpgradeLog*.htm 201 | 202 | # SQL Server files 203 | *.mdf 204 | *.ldf 205 | 206 | # Business Intelligence projects 207 | *.rdl.data 208 | *.bim.layout 209 | *.bim_*.settings 210 | 211 | # Microsoft Fakes 212 | FakesAssemblies/ 213 | 214 | # GhostDoc plugin setting file 215 | *.GhostDoc.xml 216 | 217 | # Node.js Tools for Visual Studio 218 | .ntvs_analysis.dat 219 | 220 | # Visual Studio 6 build log 221 | *.plg 222 | 223 | # Visual Studio 6 workspace options file 224 | *.opt 225 | 226 | # Visual Studio LightSwitch build output 227 | **/*.HTMLClient/GeneratedArtifacts 228 | **/*.DesktopClient/GeneratedArtifacts 229 | **/*.DesktopClient/ModelManifest.xml 230 | **/*.Server/GeneratedArtifacts 231 | **/*.Server/ModelManifest.xml 232 | _Pvt_Extensions 233 | 234 | # LightSwitch generated files 235 | GeneratedArtifacts/ 236 | ModelManifest.xml 237 | 238 | # Paket dependency manager 239 | .paket/paket.exe 240 | 241 | # FAKE - F# Make 242 | .fake/ 243 | -------------------------------------------------------------------------------- /DateRangeControl.licenseheader: -------------------------------------------------------------------------------- 1 | extensions: designer.cs generated.cs 2 | extensions: .cs .cpp .h 3 | // Copyright (c) Alexander Zhmerik. All rights reserved. 4 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 5 | extensions: .xml .config .xsd .xaml 6 | -------------------------------------------------------------------------------- /DateRangeControl.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rh.DateRange.Picker", "Rh.DateRange.Picker\Rh.DateRange.Picker.csproj", "{96416AAD-BC52-46AA-BB24-3AFF91FC5473}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rh.DateRange.Picker.Examples", "Rh.DateRange.Picker.Examples\Rh.DateRange.Picker.Examples.csproj", "{F3DF22C2-10F4-429D-9C4D-007E4D899DF6}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rh.DateRange.Picker.Tests", "Rh.DateRange.Picker.Tests\Rh.DateRange.Picker.Tests.csproj", "{F34E4C66-A154-4B8F-984A-4923F63925AB}" 11 | EndProject 12 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B71E5B4F-6230-4563-B6C4-C90B170405E4}" 13 | ProjectSection(SolutionItems) = preProject 14 | docs\DateRangePickerHorizontal.png = docs\DateRangePickerHorizontal.png 15 | docs\DateRangePickerVertical.png = docs\DateRangePickerVertical.png 16 | LICENSE.txt = LICENSE.txt 17 | README.md = README.md 18 | Rh.DateRange.Picker\Rh.DateRange.Picker.licenseheader = Rh.DateRange.Picker\Rh.DateRange.Picker.licenseheader 19 | EndProjectSection 20 | EndProject 21 | Global 22 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 23 | Debug|Any CPU = Debug|Any CPU 24 | Release|Any CPU = Release|Any CPU 25 | EndGlobalSection 26 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 27 | {96416AAD-BC52-46AA-BB24-3AFF91FC5473}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 28 | {96416AAD-BC52-46AA-BB24-3AFF91FC5473}.Debug|Any CPU.Build.0 = Debug|Any CPU 29 | {96416AAD-BC52-46AA-BB24-3AFF91FC5473}.Release|Any CPU.ActiveCfg = Release|Any CPU 30 | {96416AAD-BC52-46AA-BB24-3AFF91FC5473}.Release|Any CPU.Build.0 = Release|Any CPU 31 | {F3DF22C2-10F4-429D-9C4D-007E4D899DF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 32 | {F3DF22C2-10F4-429D-9C4D-007E4D899DF6}.Debug|Any CPU.Build.0 = Debug|Any CPU 33 | {F3DF22C2-10F4-429D-9C4D-007E4D899DF6}.Release|Any CPU.ActiveCfg = Release|Any CPU 34 | {F3DF22C2-10F4-429D-9C4D-007E4D899DF6}.Release|Any CPU.Build.0 = Release|Any CPU 35 | {F34E4C66-A154-4B8F-984A-4923F63925AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 36 | {F34E4C66-A154-4B8F-984A-4923F63925AB}.Debug|Any CPU.Build.0 = Debug|Any CPU 37 | {F34E4C66-A154-4B8F-984A-4923F63925AB}.Release|Any CPU.ActiveCfg = Release|Any CPU 38 | {F34E4C66-A154-4B8F-984A-4923F63925AB}.Release|Any CPU.Build.0 = Release|Any CPU 39 | EndGlobalSection 40 | GlobalSection(SolutionProperties) = preSolution 41 | HideSolutionNode = FALSE 42 | EndGlobalSection 43 | EndGlobal 44 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2012-2020 Alexander Zhmerik 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rh.DateRange.Picker 2 | A WPF control for choosing date ranges. Derives from Control. Requires .NET Framework 4.0. 3 | 4 | ![Sample Rh.DateRange.Picker screenshot](docs/DateRangePickerHorizontal.png) 5 | 6 | It shows 7 | - two date pickers for selecting dates, 8 | - list of predefined ranges, 9 | - buttons to step to the previous or the next range while preserving its meaning. For example, for the "Month To Date", if today is 5/24/2017, the previous range will be the period from 4/1/2017 to 4/24/2017. 10 | 11 | For a complete demo of the control, check out the project Rh.DateRange.Picker.Examples. 12 | 13 | 14 | ## How To Install 15 | Install the nuget package, or build Rh.DateRange.Picker and add reference to it 16 | in your application project. 17 | 18 | 19 | ## How To Use 20 | Add the namespace mapping ```xmlns:rh="http://schemas.rollinghours.com/wpf"``` 21 | to your XAML. Create an instance of the control in your XAML file. Bind the From and To properties to the corresponding ViewModel properties. 22 | 23 | ### Minimal Use 24 | Specify the From and To properties: 25 | ```xml 26 | 27 | ``` 28 | ### Storing values in application settings 29 | ```xml 30 | 33 | ... 34 | 37 | ... 38 | 39 | ``` 40 | ### Vertical layout 41 | Use the Orientation property to control the internal layout of the control: 42 | ```xml 43 | 47 | ``` 48 | ![Sample Rh.DateRange.Picker screenshot](docs/DateRangePickerVertical.png) 49 | 50 | 51 | ## Non-inherited properties and events 52 | ### Data-related properties 53 | Property | Description 54 | --- | --- 55 | **From** | The start of range DateTime value. If set past the current **To** value, the **To** value also gets updated to the new **From** value. **KindOfRange** is set to Custom. 56 | **To** | The end of range DateTime value. If set prior the current **From** value, the **From** value gets updated to the new **To** value. **KindOfRange** is set to Custom. 57 | **KindOfRange** | Selected kind of range, one of the DateRangeKind enumeration values such as Today, WeekToDate, MonthToDate and others. When **KindOfRange** gets updated, the **From** and **To** properties are updated accordingly. The default is Today. 58 | **Orientation** | The layout of the control. Horizontal layout places all the parts in one line, vertical layout splits the control into the 3 shorter lines. The default is Horizontal. 59 | **FirstDayOfWeek** | The DayOfWeek that represents the beginning of the week. The default is determined by the current culture. Can be set only once. 60 | **SelectedDateFormat** | A DatePickerFormat that is used to display the selected date. The default is Long. 61 | **Command** | The command to invoke when the date range is changed. 62 | **CommandParameter** | The parameter to pass to the **Command** property. 63 | 64 | ### Events 65 | Event | Description 66 | --- | --- 67 | **DateRangeChanged** | Occurs when the date range is changed, just before the **Command** is fired. 68 | 69 | ### UI-related properties 70 | Property | Description 71 | --- | --- 72 | **PreviousRangeButtonText** | The text displayed on the previous range button. The default is ❮. 73 | **NextRangeButtonText** | The text displayed on the next range button. The default is ❯. 74 | **SpacerHeight** | Vertical space between the elements when **Orientation** is Vertical. The default is 5. 75 | **SpacerWidth** | Horizontal space between the control elements such as date pickers, navigation buttons and the kind of range combo box. The default is 5. 76 | **DatePickerMinWidth** | **MinWidth** of the date pickers inside the control. The default is 220. 77 | **DatePickerToCaptionMinWidth** | **MinWidth** of the label of the "To" date picker. Affects the horizontal space between the "From" and "To" date picker labels. The default is 24. 78 | **NavigationButtonMinWidth** | **MinWidth** of the navigation buttons. The default is 24. 79 | **RangeComboBoxMinWidth** | **MinWidth** of the kind of range combo box. The default is 120. 80 | **DatePickerCaptionTextBlockStyle** | The style that is used when rendering the "From" and "To" TextBlock elements that label the date pickers. Setting the properties **TextAlignment** and **VerticalAlignment** in this style has no effect. 81 | **NavigationButtonTextBlockStyle** | The style that is used when rendering the TextBlock content of the previous and next range buttons. 82 | 83 | ## Styling the internal controls 84 | ### How to avoid changing an internal control style of the DateRangePicker by a global default style 85 | A default global style targeted to DatePicker, Button or ComboBox may affect the internals of the DateRangePicker. 86 | To avoid this, define the empty default style for the same target type but in the scope of the control. 87 | For example, if your default style is 88 | ```xml 89 | 90 | 91 | 95 | 96 | 97 | 98 | ``` 99 | set the internal button style like this: 100 | ```xml 101 | 102 | 103 | 130 | ``` 131 | for date pickers: 132 | ```xml 133 | 134 | 137 | ``` 138 | for the combo box: 139 | ```xml 140 | 141 | 145 | 146 | 9 | 13 | 17 | 20 | 27 | 30 | 38 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker.Examples/Rh.DateRange.Picker.Examples.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {F3DF22C2-10F4-429D-9C4D-007E4D899DF6} 8 | WinExe 9 | Properties 10 | Rh.DateRange.Picker.Examples 11 | Rh.DateRange.Picker.Examples 12 | v4.0 13 | 512 14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 15 | 4 16 | 17 | 18 | AnyCPU 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | true 27 | 28 | 29 | AnyCPU 30 | pdbonly 31 | true 32 | bin\Release\ 33 | TRACE 34 | prompt 35 | 4 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 4.0 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | MSBuild:Compile 55 | Designer 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | MSBuild:Compile 64 | Designer 65 | 66 | 67 | App.xaml 68 | Code 69 | 70 | 71 | MainWindow.xaml 72 | Code 73 | 74 | 75 | Designer 76 | MSBuild:Compile 77 | 78 | 79 | Designer 80 | MSBuild:Compile 81 | 82 | 83 | Designer 84 | MSBuild:Compile 85 | 86 | 87 | 88 | 89 | Code 90 | 91 | 92 | True 93 | True 94 | Resources.resx 95 | 96 | 97 | True 98 | Settings.settings 99 | True 100 | 101 | 102 | ResXFileCodeGenerator 103 | Resources.Designer.cs 104 | 105 | 106 | DateRangeControl.licenseheader 107 | 108 | 109 | SettingsSingleFileGenerator 110 | Settings.Designer.cs 111 | 112 | 113 | 114 | 115 | 116 | {96416AAD-BC52-46AA-BB24-3AFF91FC5473} 117 | Rh.DateRange.Picker 118 | 119 | 120 | 121 | 128 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker.Examples/SampleCustomStyles.xaml: -------------------------------------------------------------------------------- 1 |  3 | 5 | 6 | 14 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker.Examples/SelectedDateFormatToIsCheckedConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | using System.Globalization; 5 | using System.Windows.Controls; 6 | using System.Windows.Data; 7 | 8 | namespace Rh.DateRange.Picker.Examples { 9 | class SelectedDateFormatToIsCheckedConverter : IValueConverter { 10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { 11 | return (DatePickerFormat)value == DatePickerFormat.Short; 12 | } 13 | 14 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { 15 | return (bool?)value == true ? DatePickerFormat.Short : DatePickerFormat.Long; 16 | } 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker.Examples/StyleToIsCheckedConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | using System.Globalization; 5 | using System.Windows; 6 | using System.Windows.Data; 7 | 8 | namespace Rh.DateRange.Picker.Examples { 9 | 10 | public class StyleToIsCheckedConverter : IValueConverter { 11 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { 12 | return parameter.Equals(value); 13 | } 14 | 15 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { 16 | return true == (bool?)value ? parameter as Style : null; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker.Examples/ViewModel/ExampleViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using Rh.DateRange.Picker.Common; 4 | using System; 5 | using System.ComponentModel; 6 | 7 | namespace Rh.DateRange.Picker.Examples.ViewModel { 8 | 9 | public class ExampleViewModel : INotifyPropertyChanged { 10 | 11 | private DateTime _rangeFrom; 12 | public DateTime RangeFrom { 13 | get { return _rangeFrom; } 14 | set { 15 | _rangeFrom = value; 16 | RaisePropertyChanged(nameof(RangeFrom)); 17 | } 18 | } 19 | 20 | private DateTime _rangeTo; 21 | public DateTime RangeTo { 22 | get { return _rangeTo; } 23 | set { 24 | _rangeTo = value; 25 | RaisePropertyChanged(nameof(RangeTo)); 26 | } 27 | } 28 | 29 | private DateRangeKind _kindOfRange; 30 | public DateRangeKind KindOfRange { 31 | get { return _kindOfRange; } 32 | set { 33 | _kindOfRange = value; 34 | RaisePropertyChanged(nameof(KindOfRange)); 35 | } 36 | 37 | } 38 | 39 | 40 | private string _status; 41 | public string Status { 42 | get { return _status; } 43 | set { 44 | _status = value; 45 | RaisePropertyChanged(nameof(Status)); 46 | } 47 | } 48 | 49 | private int _commandCount; 50 | private RelayCommand _command; 51 | public RelayCommand DateRangeCommand => _command ?? 52 | (_command = new RelayCommand(r => { Status = $"Command fired {_commandCount++} times."; })); 53 | 54 | #region INPC-re 55 | 56 | private void RaisePropertyChanged(string v) { 57 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(v)); 58 | } 59 | 60 | public event PropertyChangedEventHandler PropertyChanged; 61 | 62 | #endregion 63 | 64 | } 65 | 66 | 67 | } 68 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker.Examples/ViewModel/RelayCommand.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | using System.Windows.Input; 5 | 6 | namespace Rh.DateRange.Picker.Examples.ViewModel { 7 | 8 | public class RelayCommand : ICommand { 9 | 10 | private readonly Action _execute; 11 | private readonly Predicate _canExecute; 12 | 13 | public RelayCommand(Action execute) : this(execute, null) { } 14 | 15 | public RelayCommand(Action execute, Predicate canExecute) { 16 | if (execute == null) { 17 | throw new ArgumentNullException(nameof(execute)); 18 | } 19 | 20 | _execute = execute; 21 | _canExecute = canExecute; 22 | } 23 | 24 | public bool CanExecute(object parameter) { 25 | return _canExecute?.Invoke(parameter) ?? true; 26 | } 27 | 28 | public event EventHandler CanExecuteChanged { 29 | add { CommandManager.RequerySuggested += value; } 30 | remove { CommandManager.RequerySuggested -= value; } 31 | } 32 | 33 | public void Execute(object parameter) { 34 | _execute(parameter); 35 | } 36 | 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker.Tests/DateRangeHelperTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using NUnit.Framework; 4 | using Rh.DateRange.Picker.Common; 5 | using System; 6 | using System.Collections.Generic; 7 | 8 | namespace Rh.DateRange.Picker.Tests { 9 | [TestFixture()] 10 | public class DateRangeHelperTests { 11 | 12 | private static DateTime _fromIn; 13 | private static DateTime _toIn; 14 | private static DateTime _today; 15 | private static DateTime _yesterday; 16 | private static DateTime _daysBack30; 17 | private static DateTime _daysBack7; 18 | private static DateTime _weekFirstDay; 19 | private static DateTime _weekLastDay; 20 | private static DateTime _lastWeekFirstDay; 21 | private static DateTime _lastWeekLastDay; 22 | private static DateTime _monthFirstDay; 23 | private static DateTime _monthLastDay; 24 | private static DateTime _lastMonthFirstDay; 25 | private static DateTime _lastMonthLastDay; 26 | private static DateTime _yearFirstDay; 27 | private static DateTime _yearLastDay; 28 | private static DateTime _yearBack; 29 | private static DateTime _lastYearFirstDay; 30 | private static DateTime _lastYearLastDay; 31 | 32 | //TestCaseSource'd test runs before SetUp() and SetUpFixture(), thus initialising in the static constructor 33 | static DateRangeHelperTests() { 34 | _fromIn = new DateTime(2000, 1, 5, 0, 0, 0); 35 | _toIn = new DateTime(2000, 2, 2, 0, 0, 0); 36 | 37 | var firstDayOfWeek = new FirstDayOfWeekProvider().Value; 38 | 39 | _today = DateTime.Now.Date; 40 | _yesterday = _today.AddDays(-1); 41 | _daysBack30 = _today.AddDays(-29); 42 | _daysBack7 = _today.AddDays(-6); 43 | _weekFirstDay = _today.GetWeekFirstDate(firstDayOfWeek).Date; 44 | _weekLastDay = _weekFirstDay.AddDays(6); 45 | _lastWeekFirstDay = _today.GetWeekFirstDate(firstDayOfWeek).Date.AddDays(-7); 46 | _lastWeekLastDay = _today.GetWeekFirstDate(firstDayOfWeek).Date.AddDays(-1); 47 | _monthFirstDay = _today.GetMonthFirstDate(); 48 | _monthLastDay = _today.GetMonthLastDate(); 49 | _lastMonthFirstDay = _today.AddMonths(-1).GetMonthFirstDate(); 50 | _lastMonthLastDay = _today.AddMonths(-1).GetMonthLastDate(); 51 | _yearFirstDay = _today.GetYearFirstDate(); 52 | _yearLastDay = _today.GetYearLastDate(); 53 | _yearBack = _today.AddYears(-1).AddDays(1); 54 | _lastYearFirstDay = _today.GetYearFirstDate().AddYears(-1); 55 | _lastYearLastDay = _today.GetYearLastDate().AddYears(-1); 56 | } 57 | 58 | private static IEnumerable GetSpanDatesTestCases() { 59 | yield return new TestCaseData(DateRangeKind.Custom, new DateRangeValue(_fromIn, _toIn)); 60 | yield return new TestCaseData(DateRangeKind.Today, new DateRangeValue(_today, _today)); 61 | yield return new TestCaseData(DateRangeKind.Yesterday, new DateRangeValue(_yesterday, _yesterday)); 62 | yield return new TestCaseData(DateRangeKind.Last30Days, new DateRangeValue(_daysBack30, _today)); 63 | yield return new TestCaseData(DateRangeKind.Last7Days, new DateRangeValue(_daysBack7, _today)); 64 | yield return new TestCaseData(DateRangeKind.TheLastYear, new DateRangeValue(_yearBack, _today)); 65 | yield return new TestCaseData(DateRangeKind.MonthToDate, new DateRangeValue(_monthFirstDay, _today)); 66 | yield return new TestCaseData(DateRangeKind.LastMonth, new DateRangeValue(_lastMonthFirstDay, _lastMonthLastDay)); 67 | yield return new TestCaseData(DateRangeKind.LastWeek, new DateRangeValue(_lastWeekFirstDay, _lastWeekLastDay)); 68 | yield return new TestCaseData(DateRangeKind.LastYear, new DateRangeValue(_lastYearFirstDay, _lastYearLastDay)); 69 | yield return new TestCaseData(DateRangeKind.WeekToDate, new DateRangeValue(_weekFirstDay, _today)); 70 | yield return new TestCaseData(DateRangeKind.YearToDate, new DateRangeValue(_yearFirstDay, _today)); 71 | } 72 | 73 | [Test(), TestCaseSource(nameof(GetSpanDatesTestCases))] 74 | public void GetSpanDatesTest(DateRangeKind kind, DateRangeValue expected) { 75 | var result = DateRangeHelper.GetDateRangeDates(kind, _fromIn, _toIn); 76 | Assert.AreEqual(expected, result); 77 | } 78 | 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker.Tests/DateRangePickerTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using NUnit.Framework; 4 | using Rh.DateRange.Picker.Common; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Threading; 8 | using System.Linq; 9 | 10 | namespace Rh.DateRange.Picker.Tests { 11 | /// 12 | /// This tests the proper DateRangePicker initialization (OnApplyTemplate) against different 13 | /// To vs. From vs. KindOfDateRange property value combinations provided 14 | /// in XAML by the user. 15 | /// 16 | [TestFixture, RequiresThread(ApartmentState.STA)] 17 | public class DateRangePickerTests { 18 | 19 | //nullables are for the case user has not set the paramater 20 | public struct PickerDataProps { 21 | public DateTime? From { get; } 22 | public DateTime? To { get; } 23 | public DateRangeKind? Kind { get; } 24 | 25 | public PickerDataProps(DateTime? from = null, DateTime? to = null, DateRangeKind? kind = null) { 26 | From = from; 27 | To = to; 28 | Kind = kind; 29 | } 30 | } 31 | 32 | private DateRangePicker _picker; 33 | private static readonly DateTime PastDate1 = new DateTime(2001, 01, 01); 34 | private static readonly DateTime PastDate2 = new DateTime(2002, 02, 02); 35 | private static readonly DateTime FutureDate = new DateTime(2100, 01, 01); 36 | private static readonly DateTime Today = DateTime.Now.Date; 37 | private static readonly DateTime Yesterday = DateTime.Now.AddDays(-1).Date; 38 | 39 | 40 | private static IEnumerable OnApplyTemplateCases() { 41 | 42 | var testName = nameof(OnApplyTemplateCases); 43 | 44 | yield return new TestCaseData( 45 | new PickerDataProps(), new PickerDataProps(Today, Today, DateRangeKind.Today)) 46 | .SetName($"{testName}: 010"); 47 | 48 | yield return new TestCaseData( 49 | new PickerDataProps(null, null, DateRangeKind.Custom), new PickerDataProps(Yesterday, Today, DateRangeKind.Custom)) 50 | .SetName($"{testName}: 020"); 51 | 52 | 53 | foreach (var kind in new DateRangeKind?[] { null, DateRangeKind.Custom }) { 54 | 55 | yield return new TestCaseData( 56 | new PickerDataProps(null, PastDate1, kind), new PickerDataProps(PastDate1, PastDate1, DateRangeKind.Custom)) 57 | .SetName($"{testName}: 030 {kind}"); 58 | 59 | yield return new TestCaseData( 60 | new PickerDataProps(null, FutureDate, kind), new PickerDataProps(Yesterday, FutureDate, DateRangeKind.Custom)) 61 | .SetName($"{testName}: 040 {kind}"); 62 | 63 | yield return new TestCaseData( 64 | new PickerDataProps(PastDate1, null, kind), new PickerDataProps(PastDate1, Today, DateRangeKind.Custom)) 65 | .SetName($"{testName}: 050 {kind}"); 66 | 67 | yield return new TestCaseData( 68 | new PickerDataProps(FutureDate, null, kind), new PickerDataProps(FutureDate, FutureDate, DateRangeKind.Custom)) 69 | .SetName($"{testName}: 060 {kind}"); 70 | 71 | yield return new TestCaseData( 72 | new PickerDataProps(PastDate1, PastDate2, kind), new PickerDataProps(PastDate1, PastDate2, DateRangeKind.Custom)) 73 | .SetName($"{testName}: 070 {kind}"); 74 | 75 | yield return new TestCaseData( 76 | new PickerDataProps(PastDate2, PastDate1, kind), new PickerDataProps(PastDate2, PastDate2, DateRangeKind.Custom)) 77 | .SetName($"{testName}: 080 {kind}"); 78 | 79 | } 80 | 81 | 82 | foreach (DateRangeKind kind in Enum.GetValues(typeof(DateRangeKind))) { 83 | 84 | var kindsToPassBy = new DateRangeKind[] { DateRangeKind.Custom, DateRangeKind.Week, DateRangeKind.Month, DateRangeKind.Year }; 85 | 86 | if (kindsToPassBy.Contains(kind)) { 87 | continue; 88 | } 89 | 90 | //for the case when DateRangeKind enum has more kinds than are actually contained in the Picker's DateRangeList. 91 | var dateRange = DateRangeHelper.GetDateRangeOfKind(kind); 92 | if (null == dateRange) { 93 | continue; 94 | } 95 | 96 | yield return new TestCaseData( 97 | new PickerDataProps(null, null, kind), 98 | new PickerDataProps(dateRange.From, dateRange.To, kind)) 99 | .SetName($"{testName}: 110 {kind}"); 100 | 101 | yield return new TestCaseData( 102 | new PickerDataProps(PastDate1, null, kind), 103 | new PickerDataProps(dateRange.From, dateRange.To, kind)) 104 | .SetName($"{testName}: 120 {kind}"); 105 | 106 | yield return new TestCaseData( 107 | new PickerDataProps(null, PastDate1, kind), 108 | new PickerDataProps(dateRange.From, dateRange.To, kind)) 109 | .SetName($"{testName}: 130 {kind}"); 110 | 111 | yield return new TestCaseData( 112 | new PickerDataProps(PastDate1, PastDate2, kind), 113 | new PickerDataProps(dateRange.From, dateRange.To, kind)) 114 | .SetName($"{testName}: 140 {kind}"); 115 | 116 | yield return new TestCaseData( 117 | new PickerDataProps(PastDate2, PastDate1, kind), 118 | new PickerDataProps(dateRange.From, dateRange.To, kind)) 119 | .SetName($"{testName}: 150 {kind}"); 120 | 121 | } 122 | 123 | } 124 | 125 | 126 | [SetUp] 127 | public void SetUp() { 128 | _picker = new DateRangePicker(); 129 | } 130 | 131 | [Test()] 132 | public void DateRangePickerTest() { 133 | Assert.That(_picker.KindOfRange, Is.Null); 134 | Assert.That(_picker.From, Is.EqualTo(new DateTime(0))); 135 | Assert.That(_picker.To, Is.EqualTo(new DateTime(0))); 136 | } 137 | 138 | [Test(), TestCaseSource(nameof(OnApplyTemplateCases))] 139 | public void OnApplyTemplateTest(PickerDataProps userSets, PickerDataProps result) { 140 | if (userSets.From != null) { 141 | _picker.From = (DateTime)userSets.From; 142 | } 143 | if (userSets.To != null) { 144 | _picker.To = (DateTime)userSets.To; 145 | } 146 | if (userSets.Kind != null) { 147 | _picker.KindOfRange = (DateRangeKind)userSets.Kind; 148 | } 149 | 150 | _picker.OnApplyTemplate(); 151 | 152 | Assert.That(_picker.KindOfRange, Is.EqualTo(result.Kind)); 153 | Assert.That(_picker.From, Is.EqualTo(result.From)); 154 | Assert.That(_picker.To, Is.EqualTo(result.To)); 155 | } 156 | 157 | } 158 | } -------------------------------------------------------------------------------- /Rh.DateRange.Picker.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System.Reflection; 4 | using System.Runtime.InteropServices; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("Rh.DateRange.Picker.Tests")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("Rh.DateRange.Picker.Tests")] 14 | [assembly: AssemblyCopyright("Copyright © 2017")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // Setting ComVisible to false makes the types in this assembly not visible 19 | // to COM components. If you need to access a type in this assembly from 20 | // COM, set the ComVisible attribute to true on that type. 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | [assembly: Guid("f34e4c66-a154-4b8f-984a-4923f63925ab")] 25 | 26 | // Version information for an assembly consists of the following four values: 27 | // 28 | // Major Version 29 | // Minor Version 30 | // Build Number 31 | // Revision 32 | // 33 | // You can specify all the values or you can default the Build and Revision Numbers 34 | // by using the '*' as shown below: 35 | // [assembly: AssemblyVersion("1.0.*")] 36 | [assembly: AssemblyVersion("1.0.0.0")] 37 | [assembly: AssemblyFileVersion("1.0.0.0")] 38 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker.Tests/RangeCustomTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using NUnit.Framework; 4 | using Rh.DateRange.Picker.Common; 5 | using System; 6 | 7 | namespace Rh.DateRange.Picker.Tests { 8 | [TestFixture()] 9 | public class RangeCustomTests { 10 | 11 | private DateTime _start; 12 | private DateTime _end; 13 | 14 | [SetUp()] 15 | public void SetUp() { 16 | _start = new DateTime(2015, 2, 15); 17 | _end = new DateTime(2015, 2, 20); 18 | } 19 | 20 | [Test()] 21 | public void RangeCustomTest() { 22 | var result = new RangeCustom(); 23 | Assert.AreEqual(result.To, DateTime.Now.Date); 24 | Assert.AreEqual(result.From, DateTime.Now.AddDays(-1).Date); 25 | } 26 | 27 | [Test(), Sequential] 28 | public void RangeCustomTestWithInput([Values(42050/*20150215*/, 42055, 42055.5)] double end) { 29 | var dateEnd = DateTime.FromOADate(end); 30 | var result = new RangeCustom(_start, dateEnd); 31 | Assert.AreEqual(result.From, _start.Date); 32 | Assert.AreEqual(result.To, dateEnd.Date); 33 | } 34 | 35 | [Test()] 36 | public void RangeCustomTestWithInputWrong() { 37 | TestDelegate d = () => new RangeCustom(_end, _start); 38 | Assert.That(d, Throws.ArgumentException); 39 | } 40 | 41 | 42 | [Test()] 43 | public void RefreshTest() { 44 | var range = new RangeCustom(_start, _end); 45 | var result = range.Refresh(); 46 | Assert.AreNotSame(range, result); 47 | Assert.AreEqual(result.From, _start); 48 | Assert.AreEqual(result.To, _end); 49 | } 50 | 51 | [Test(), Sequential] 52 | public void GetNextRangeTest( 53 | [Values(15, 15, 15.9)] double start, 54 | [Values(20, 15, 16.1)] double end ) { 55 | 56 | var from = DateTime.FromOADate(start); 57 | var to = DateTime.FromOADate(end); 58 | int span = (int)(to.Date - from.Date).TotalDays; 59 | 60 | IDateRange range = new RangeCustom(from, to); 61 | 62 | for (int i = 1; i < 10; i++) { 63 | range = range.GetNextRange(); 64 | Assert.AreEqual(range.From, from.AddDays(span * i + i).Date, $"From, i={i}"); 65 | Assert.AreEqual(range.To, to.AddDays(span * i + i).Date, $"To, i={i}"); 66 | } 67 | } 68 | 69 | [Test(), Sequential] 70 | public void GetPreviousRangeTest( 71 | [Values(15, 15, 15.9)] double start, 72 | [Values(20, 15, 16.1)] double end) { 73 | 74 | var from = DateTime.FromOADate(start); 75 | var to = DateTime.FromOADate(end); 76 | int span = (int)(to.Date - from.Date).TotalDays; 77 | 78 | IDateRange range = new RangeCustom(from, to); 79 | 80 | for (int i = 1; i < 10; i++) { 81 | range = range.GetPreviousRange(); 82 | Assert.AreEqual(range.From, from.AddDays(-span * i - i).Date, $"From, i={i}"); 83 | Assert.AreEqual(range.To, to.AddDays(-span * i - i).Date, $"To, i={i}"); 84 | } 85 | } 86 | } 87 | } -------------------------------------------------------------------------------- /Rh.DateRange.Picker.Tests/Rh.DateRange.Picker.Tests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | {F34E4C66-A154-4B8F-984A-4923F63925AB} 7 | Library 8 | Properties 9 | Rh.DateRange.Picker.Tests 10 | Rh.DateRange.Picker.Tests 11 | v4.0 12 | 512 13 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 14 | 10.0 15 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 16 | $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages 17 | False 18 | UnitTest 19 | 20 | 21 | 22 | true 23 | full 24 | false 25 | bin\Debug\ 26 | DEBUG;TRACE 27 | prompt 28 | 4 29 | true 30 | 31 | 32 | pdbonly 33 | true 34 | bin\Release\ 35 | TRACE 36 | prompt 37 | 4 38 | 39 | 40 | 41 | ..\packages\NUnit.3.6.1\lib\net40\nunit.framework.dll 42 | True 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | DateRangeControl.licenseheader 67 | 68 | 69 | 70 | 71 | 72 | {96416AAD-BC52-46AA-BB24-3AFF91FC5473} 73 | Rh.DateRange.Picker 74 | 75 | 76 | 77 | 78 | 79 | 80 | False 81 | 82 | 83 | False 84 | 85 | 86 | False 87 | 88 | 89 | False 90 | 91 | 92 | 93 | 94 | 95 | 96 | 103 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker.Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/BuildNugetPackage.cmd: -------------------------------------------------------------------------------- 1 | NuGet.exe pack Rh.DateRange.Picker.csproj -Prop Configuration=Release 2 | pause -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Common/DateRangeChangedEventArgs.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | 5 | namespace Rh.DateRange.Picker.Common { 6 | internal class DateRangeChangedEventArgs: EventArgs { 7 | public IDateRange NewValue { get; } 8 | public IDateRange OldValue { get; } 9 | 10 | public DateRangeChangedEventArgs(IDateRange oldValue, IDateRange newValue) { 11 | OldValue = oldValue ?? new RangeCustom(); 12 | NewValue = newValue; 13 | } 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Common/DateRangeExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | namespace Rh.DateRange.Picker.Common { 4 | public static class DateRangeExtensions { 5 | public static DateRangeValue GetDateRangeValue(this IDateRange dateRange) { 6 | return new DateRangeValue(dateRange.From, dateRange.To); 7 | } 8 | 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Common/DateRangeHelper.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | using System.Resources; 5 | using System.Globalization; 6 | 7 | namespace Rh.DateRange.Picker.Common { 8 | public static class DateRangeHelper { 9 | 10 | internal static DateRangeList BuildDateRangeList(IFirstDayOfWeekProvider firstDayOfWeekProvider, ResourceManager resourceManager = null) { 11 | return new DateRangeList(new[] { 12 | new RangePresenter(resourceManager, new RangeDay()), 13 | new RangePresenter(resourceManager, new RangeYesterday()), 14 | new RangePresenter(resourceManager, new RangeWeekToDate(firstDayOfWeekProvider)), 15 | new RangePresenter(resourceManager, new RangeMonthToDate()), 16 | new RangePresenter(resourceManager, new RangeYearToDate()), 17 | new RangePresenter(resourceManager, new RangeLastWeek(firstDayOfWeekProvider)), 18 | new RangePresenter(resourceManager, new RangeLastMonth()), 19 | new RangePresenter(resourceManager, new RangeLastYear()), 20 | new RangePresenter(resourceManager, new RangeLast7Days()), 21 | new RangePresenter(resourceManager, new RangeLast30Days()), 22 | new RangePresenter(resourceManager, new RangeTheLastYear()), 23 | new RangePresenter(resourceManager, new RangeCustom()) 24 | }); 25 | } 26 | 27 | 28 | /// 29 | /// Returns recalculated date range as DateRangeValue for the given input parameters. 30 | /// 31 | /// The kind of range to calculate. 32 | /// Start DateTime of the range. Has sense only if the rangeKind parameter is set to Custom. 33 | /// End DateTime of the range. Has sense only if the rangeKind parameter is set to Custom. 34 | public static DateRangeValue GetDateRangeDates(DateRangeKind rangeKind, DateTime from, DateTime to) { 35 | return GetDateRangeDates(rangeKind, from, to, CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek); 36 | } 37 | 38 | public static DateRangeValue GetDateRangeDates(DateRangeKind rangeKind, DateTime from, DateTime to, DayOfWeek firstDayOfWeek) { 39 | if (DateRangeKind.Custom == rangeKind) { 40 | return new DateRangeValue(from, to); 41 | } 42 | 43 | var range = GetDateRangeOfKind(rangeKind, firstDayOfWeek); 44 | return new DateRangeValue(range.From, range.To); 45 | } 46 | 47 | 48 | /// 49 | /// Returns DateRange with date values calculated for the given input rangeKind parameter. 50 | /// 51 | internal static IDateRange GetDateRangeOfKind(DateRangeKind rangeKind) { 52 | return GetDateRangeOfKind(rangeKind, CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek); 53 | } 54 | 55 | private static IDateRange GetDateRangeOfKind(DateRangeKind rangeKind, DayOfWeek firstDayOfWeek) { 56 | var firstDayOfWeekProvider = new FirstDayOfWeekProvider() { Value = firstDayOfWeek }; 57 | var list = BuildDateRangeList(firstDayOfWeekProvider); 58 | list.CurrentKindOfRange = rangeKind; 59 | return list.Current; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Common/DateRangeKind.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | namespace Rh.DateRange.Picker.Common { 4 | public enum DateRangeKind { 5 | Today, 6 | Yesterday, 7 | WeekToDate, 8 | MonthToDate, 9 | YearToDate, 10 | LastWeek, 11 | LastMonth, 12 | LastYear, 13 | Week, 14 | Month, 15 | Year, 16 | Last7Days, 17 | Last30Days, 18 | TheLastYear, 19 | Custom 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Common/DateRangeList.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | 7 | namespace Rh.DateRange.Picker.Common { 8 | 9 | public class DateRangeList : List { 10 | 11 | private RangePresenter _current; 12 | 13 | internal event EventHandler CurrentChanged; 14 | 15 | internal DateRangeList(RangePresenter[] ranges) { 16 | if (0 == ranges.Length) { 17 | throw new ArgumentException($"{nameof(ranges)} can not be empty."); 18 | } 19 | 20 | if (null == ranges.FirstOrDefault(dr => DateRangeKind.Custom == dr.Kind)) { 21 | throw new ArgumentException($"{nameof(ranges)} must contain an instance of the Custom date range."); 22 | } 23 | 24 | //making sure the ranges argument has no multiple ranges of the same kind 25 | var r = ranges.Select(ds => ds.Kind).Count() == ranges.GroupBy(ds => ds.Kind).Count(); 26 | if (!r) { 27 | throw new ArgumentException($"{nameof(ranges)} has multiple ranges of the same kind."); 28 | } 29 | 30 | AddRange(ranges); 31 | _current = GetItemByKind(DateRangeKind.Custom); 32 | } 33 | 34 | protected RangePresenter GetItemByKind(DateRangeKind? kind) 35 | => this.First(rp => kind == rp.Kind); 36 | 37 | internal DateRangeKind? CurrentKindOfRange { 38 | get { return _current.Kind; } 39 | set { 40 | if ((null != Current) && Current.Kind.Equals(value)) { 41 | return; 42 | } 43 | Current = (RangePresenter)GetItemByKind(value)?.Refresh(); 44 | } 45 | } 46 | 47 | internal RangePresenter Current { 48 | get { return _current; } 49 | private set { 50 | if ((null != value) && value.Equals(_current)) { 51 | return; 52 | } 53 | var previous = _current; 54 | _current = value; 55 | CurrentChanged?.Invoke(this, new DateRangeChangedEventArgs(previous, _current)); 56 | } 57 | } 58 | 59 | internal void SetPreviousRange() { 60 | SetCustomRange(_current.GetPreviousRange()); 61 | } 62 | 63 | internal void SetNextRange() { 64 | SetCustomRange(_current.GetNextRange()); 65 | } 66 | 67 | private void SetCustomRange(IDateRange dateRange) { 68 | if (null == dateRange) { throw new ArgumentNullException(nameof(dateRange)); } 69 | 70 | var custom = GetItemByKind(DateRangeKind.Custom); 71 | var customIndex = IndexOf(custom); 72 | var forceCustom = true; 73 | this[customIndex] = new RangePresenter(custom.ResourceManager, dateRange, forceCustom); 74 | 75 | Current = this[customIndex]; 76 | } 77 | 78 | internal void SetCustomWithNewFromDate(DateTime from) { 79 | if (Current.From != from) { 80 | var to = from <= Current.To ? Current.To : from; 81 | SetCustomRange(new RangeCustom(from, to)); 82 | } 83 | } 84 | 85 | internal void SetCustomWithNewToDate(DateTime to) { 86 | if (Current.To != to) { 87 | var from = to >= Current.From ? Current.From : to; 88 | SetCustomRange(new RangeCustom(from, to)); 89 | } 90 | } 91 | 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Common/DateTimeExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | 5 | namespace Rh.DateRange.Picker.Common { 6 | internal static class DateTimeExtensions { 7 | 8 | internal static DateTime GetWeekFirstDate(this DateTime date, DayOfWeek firstDayOfWeek) { 9 | if (firstDayOfWeek == date.DayOfWeek) { 10 | return date.Date; 11 | } 12 | int num = firstDayOfWeek < date.DayOfWeek ? date.DayOfWeek - firstDayOfWeek : 7 - (firstDayOfWeek - date.DayOfWeek); 13 | return date.AddDays(-num).Date; 14 | } 15 | 16 | internal static DateTime GetWeekLastDate(this DateTime date, DayOfWeek firstDayOfWeek) { 17 | return date.GetWeekFirstDate(firstDayOfWeek).AddDays(6).Date; 18 | } 19 | 20 | internal static DateTime GetMonthFirstDate(this DateTime date) 21 | => new DateTime(date.Year, date.Month, 1).Date; 22 | 23 | internal static DateTime GetMonthLastDate(this DateTime date) { 24 | return date.GetMonthFirstDate().AddMonths(1).AddDays(-1).Date; 25 | } 26 | 27 | internal static DateTime GetYearFirstDate(this DateTime date) { 28 | return new DateTime(date.Year, 1, 1).Date; 29 | } 30 | 31 | internal static DateTime GetYearLastDate(this DateTime date) { 32 | return new DateTime(date.Year, 12, 31).Date; 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Common/IDateRange.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | 5 | namespace Rh.DateRange.Picker.Common { 6 | public interface IDateRange { 7 | DateTime From { get; } 8 | DateTime To { get; } 9 | DateRangeKind Kind { get; } 10 | IDateRange Refresh(); 11 | IDateRange GetPreviousRange(); 12 | IDateRange GetNextRange(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Common/RangeCustom.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | 5 | 6 | namespace Rh.DateRange.Picker.Common { 7 | 8 | public class RangeCustom : IDateRange { 9 | private readonly int _dayCount; 10 | 11 | public DateTime From { get; } 12 | 13 | public DateTime To { get; } 14 | 15 | public RangeCustom() : this(DateTime.Now.AddDays(-1).Date, DateTime.Now.Date) { } 16 | 17 | public RangeCustom(DateTime from, DateTime to, int dayCount = 0) { 18 | if (from > to) { throw new ArgumentException($"{nameof(from)} is later than {nameof(to)}"); } 19 | 20 | From = from.Date; 21 | To = to.Date; 22 | _dayCount = dayCount == 0 ? (int)(To - From).TotalDays + 1 : dayCount; 23 | } 24 | 25 | public virtual DateRangeKind Kind => DateRangeKind.Custom; 26 | 27 | public virtual IDateRange Refresh() => new RangeCustom(From, To); 28 | 29 | public virtual IDateRange GetNextRange() { 30 | DateTime from = To.AddDays(1); 31 | DateTime to = _dayCount > 0 ? from.AddDays(_dayCount - 1) : from.Add(To - From); 32 | return new RangeCustom(from, to, _dayCount); 33 | } 34 | 35 | public virtual IDateRange GetPreviousRange() { 36 | DateTime to = From.AddDays(-1); 37 | DateTime from = _dayCount > 0 ? to.AddDays(-_dayCount + 1) : to.AddDays(-(To - From).TotalDays + 1); 38 | return new RangeCustom(from, to, _dayCount); 39 | } 40 | 41 | } 42 | 43 | } 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Common/RangeDay.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | 5 | namespace Rh.DateRange.Picker.Common { 6 | 7 | public class RangeDay : IDateRange { 8 | public DateTime From { get; } 9 | 10 | public DateTime To { get; } 11 | 12 | public RangeDay() : this(DateTime.Now) { } 13 | 14 | public RangeDay(DateTime dateTime) { 15 | From = To = dateTime.Date; 16 | } 17 | 18 | public DateRangeKind Kind => DateRangeKind.Today; 19 | 20 | public IDateRange Refresh() => new RangeDay(); 21 | 22 | public IDateRange GetNextRange() => new RangeDay(To.AddDays(1)); 23 | 24 | public IDateRange GetPreviousRange() => new RangeDay(From.AddDays(-1)); 25 | 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Common/RangeFirstDayOfWeekAware.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | using System.ComponentModel; 5 | 6 | namespace Rh.DateRange.Picker.Common { 7 | public abstract class RangeFirstDayOfWeekAware : IDateRange { 8 | 9 | protected readonly IFirstDayOfWeekProvider FirstDayOfWeekProvider; 10 | 11 | public DateTime From { get; protected set; } 12 | 13 | public DateTime To { get; protected set; } 14 | 15 | public DateRangeKind Kind { get; protected set; } 16 | 17 | protected RangeFirstDayOfWeekAware(IFirstDayOfWeekProvider firstDayOfWeekProvider) { 18 | FirstDayOfWeekProvider = firstDayOfWeekProvider; 19 | FirstDayOfWeekProvider.PropertyChanged += ReFirstDayOfWeekChanged; 20 | } 21 | 22 | protected void CleanUp() { 23 | FirstDayOfWeekProvider.PropertyChanged -= ReFirstDayOfWeekChanged; 24 | } 25 | 26 | 27 | public abstract IDateRange GetNextRange(); 28 | 29 | public abstract IDateRange GetPreviousRange(); 30 | 31 | public abstract IDateRange Refresh(); 32 | 33 | private void ReFirstDayOfWeekChanged(object sender, PropertyChangedEventArgs e) { 34 | var provider = sender as IFirstDayOfWeekProvider; 35 | if ((null != provider) && nameof(provider.Value).Equals(e.PropertyName)) { 36 | Refresh(); 37 | } 38 | 39 | } 40 | 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Common/RangeLast30Days.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | 5 | namespace Rh.DateRange.Picker.Common { 6 | public class RangeLast30Days : RangeCustom { 7 | 8 | public RangeLast30Days() : base(DateTime.Now.AddDays(-29), DateTime.Now) { } 9 | 10 | public override DateRangeKind Kind => DateRangeKind.Last30Days; 11 | 12 | public override IDateRange Refresh() => new RangeLast30Days(); 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Common/RangeLast7Days.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | 5 | namespace Rh.DateRange.Picker.Common { 6 | public class RangeLast7Days : RangeCustom { 7 | public RangeLast7Days() : base(DateTime.Now.AddDays(- 6), DateTime.Now) { } 8 | 9 | public override DateRangeKind Kind => DateRangeKind.Last7Days; 10 | 11 | public override IDateRange Refresh() => new RangeLast7Days(); 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Common/RangeLastMonth.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | 5 | namespace Rh.DateRange.Picker.Common { 6 | public class RangeLastMonth : IDateRange { 7 | 8 | public DateTime From { get; } 9 | 10 | public DateTime To { get; } 11 | 12 | public RangeLastMonth() : this(new RangeMonth().GetPreviousRange()) { } 13 | 14 | private RangeLastMonth(IDateRange previousMonthRange) { 15 | From = previousMonthRange.From; 16 | To = previousMonthRange.To; 17 | } 18 | 19 | public DateRangeKind Kind => DateRangeKind.LastMonth; 20 | 21 | public IDateRange Refresh() => new RangeLastMonth(); 22 | 23 | public IDateRange GetNextRange() => new RangeLastMonth(new RangeMonth(To.AddDays(1))); 24 | 25 | public IDateRange GetPreviousRange() => new RangeLastMonth(new RangeMonth(From.AddDays(-1))); 26 | 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Common/RangeLastWeek.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | namespace Rh.DateRange.Picker.Common { 4 | public class RangeLastWeek : RangeFirstDayOfWeekAware { 5 | 6 | public RangeLastWeek(IFirstDayOfWeekProvider firstDayOfWeekProvider) : 7 | this((RangeWeek)new RangeWeek(firstDayOfWeekProvider).GetPreviousRange(), firstDayOfWeekProvider) { } 8 | 9 | private RangeLastWeek(RangeWeek previousWeekRange, IFirstDayOfWeekProvider firstDayOfWeekProvider) : base(firstDayOfWeekProvider) { 10 | From = previousWeekRange.From; 11 | To = previousWeekRange.To; 12 | Kind = DateRangeKind.LastWeek; 13 | } 14 | 15 | public override IDateRange Refresh() { 16 | CleanUp(); 17 | return new RangeLastWeek(FirstDayOfWeekProvider); 18 | } 19 | 20 | public override IDateRange GetNextRange() => new RangeLastWeek(new RangeWeek(To.AddDays(1), FirstDayOfWeekProvider), FirstDayOfWeekProvider); 21 | 22 | public override IDateRange GetPreviousRange() => new RangeLastWeek(new RangeWeek(From.AddDays(-1), FirstDayOfWeekProvider), FirstDayOfWeekProvider); 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Common/RangeLastYear.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | 5 | namespace Rh.DateRange.Picker.Common { 6 | public class RangeLastYear : IDateRange { 7 | 8 | public DateTime From { get; } 9 | 10 | public DateTime To { get; } 11 | 12 | public RangeLastYear() : this(new RangeYear().GetPreviousRange()) { } 13 | 14 | private RangeLastYear(IDateRange previousYearRange) { 15 | From = previousYearRange.From; 16 | To = previousYearRange.To; 17 | } 18 | 19 | public DateRangeKind Kind => DateRangeKind.LastYear; 20 | 21 | public IDateRange Refresh() => new RangeLastYear(); 22 | 23 | public IDateRange GetNextRange() => new RangeLastYear(new RangeYear(To.AddDays(1))); 24 | 25 | public IDateRange GetPreviousRange() => new RangeLastYear(new RangeYear(From.AddDays(-1))); 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Common/RangeMonth.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | 5 | namespace Rh.DateRange.Picker.Common { 6 | 7 | public class RangeMonth : IDateRange { 8 | 9 | public DateTime From { get; } 10 | 11 | public DateTime To { get; } 12 | 13 | public RangeMonth() : this(DateTime.Now) { } 14 | 15 | public RangeMonth(DateTime dateTime) { 16 | From = dateTime.GetMonthFirstDate(); 17 | To = dateTime.GetMonthLastDate(); 18 | } 19 | 20 | public DateRangeKind Kind => DateRangeKind.Month; 21 | 22 | public IDateRange Refresh() => new RangeMonth(); 23 | 24 | public IDateRange GetNextRange() => new RangeMonth(To.AddDays(1)); 25 | 26 | public IDateRange GetPreviousRange() => new RangeMonth(From.AddDays(-1)); 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Common/RangeMonthToDate.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | 5 | namespace Rh.DateRange.Picker.Common { 6 | public class RangeMonthToDate : IDateRange { 7 | 8 | public DateTime From { get; } 9 | 10 | public DateTime To { get; } 11 | 12 | private readonly int _dayCount; 13 | 14 | public RangeMonthToDate() { 15 | From = DateTime.Now.GetMonthFirstDate(); 16 | To = DateTime.Now.Date; 17 | _dayCount = (int)(To - From).TotalDays + 1; 18 | } 19 | 20 | private RangeMonthToDate(DateTime from, int dayCount) { 21 | From = from; 22 | _dayCount = dayCount; 23 | 24 | var fromDate = from; 25 | var daysInMonth = DateTime.DaysInMonth(fromDate.Year, fromDate.Month); 26 | 27 | //align to the end of month if exceeded 28 | To = _dayCount > daysInMonth ? from.AddDays(daysInMonth - 1) : from.AddDays(_dayCount - 1); 29 | 30 | } 31 | 32 | public DateRangeKind Kind => DateRangeKind.MonthToDate; 33 | 34 | public IDateRange Refresh() => new RangeMonthToDate(); 35 | 36 | public IDateRange GetNextRange() { 37 | var nextFirstDate = From.GetMonthLastDate().AddDays(1); 38 | return new RangeMonthToDate(nextFirstDate, _dayCount); 39 | } 40 | 41 | public IDateRange GetPreviousRange() { 42 | var prevFirstDate = From.AddDays(-1).GetMonthFirstDate(); 43 | return new RangeMonthToDate(prevFirstDate, _dayCount); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Common/RangePresenter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | using System.Resources; 5 | 6 | namespace Rh.DateRange.Picker.Common { 7 | 8 | public class RangePresenter : IDateRange { 9 | 10 | private IDateRange _dateRange; 11 | 12 | private readonly bool _forceCustom; 13 | 14 | public DateTime From => _dateRange.From; 15 | 16 | public DateTime To => _dateRange.To; 17 | 18 | public ResourceManager ResourceManager { get; } 19 | 20 | public RangePresenter(ResourceManager resourceManager, IDateRange range, bool forceCustom = false) { 21 | _dateRange = range; 22 | _forceCustom = forceCustom; 23 | ResourceManager = resourceManager; 24 | } 25 | 26 | //SelectedValuePath for the kind of range combobox 27 | public DateRangeKind Kind => _forceCustom ? DateRangeKind.Custom : _dateRange.Kind; 28 | 29 | //DisplayMemberPath for the kind of range combobox 30 | public string DisplayName { 31 | get { 32 | var s = ResourceManager?.GetString(Kind.ToString()); 33 | return string.IsNullOrWhiteSpace(s) ? $"{Kind.ToString()}" : s; 34 | } 35 | } 36 | 37 | //the underlying type of the decorated range remains the same to keep the correct steps for prev/next range getting 38 | public IDateRange GetPreviousRange() => _dateRange.GetPreviousRange(); 39 | 40 | public IDateRange GetNextRange() => _dateRange.GetNextRange(); 41 | 42 | public IDateRange Refresh() { 43 | _dateRange = _dateRange.Refresh(); 44 | return this; 45 | } 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Common/RangeTheLastYear.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | 5 | namespace Rh.DateRange.Picker.Common { 6 | public class RangeTheLastYear : IDateRange { 7 | 8 | public DateTime From { get; } 9 | 10 | public DateTime To { get; } 11 | 12 | public RangeTheLastYear() : this(DateTime.Now.AddYears(-1).AddDays(1), DateTime.Now) { } 13 | 14 | private RangeTheLastYear(DateTime from, DateTime to) { 15 | From = from.Date; 16 | To = to.Date; 17 | } 18 | 19 | public DateRangeKind Kind => DateRangeKind.TheLastYear; 20 | 21 | public IDateRange Refresh() => new RangeTheLastYear(); 22 | 23 | public IDateRange GetNextRange() => new RangeTheLastYear(To.AddDays(1), To.AddYears(1)); 24 | 25 | public IDateRange GetPreviousRange() => new RangeTheLastYear(From.AddYears(-1), From.AddDays(-1)); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Common/RangeWeek.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | 5 | namespace Rh.DateRange.Picker.Common { 6 | 7 | public class RangeWeek : RangeFirstDayOfWeekAware { 8 | 9 | public RangeWeek(IFirstDayOfWeekProvider firstDayOfWeekProvider) : this(DateTime.Now, firstDayOfWeekProvider) { } 10 | 11 | public RangeWeek(DateTime date, IFirstDayOfWeekProvider firstDayOfWeekProvider) : base(firstDayOfWeekProvider) { 12 | From = date.GetWeekFirstDate(firstDayOfWeekProvider.Value); 13 | To = date.GetWeekLastDate(firstDayOfWeekProvider.Value); 14 | Kind = DateRangeKind.Week; 15 | } 16 | 17 | 18 | public override IDateRange Refresh() { 19 | CleanUp(); 20 | return new RangeWeek(FirstDayOfWeekProvider); 21 | } 22 | 23 | public override IDateRange GetNextRange() => new RangeWeek(To.AddDays(1), FirstDayOfWeekProvider); 24 | 25 | public override IDateRange GetPreviousRange() => new RangeWeek(From.AddDays(-1), FirstDayOfWeekProvider); 26 | 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Common/RangeWeekToDate.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | 5 | namespace Rh.DateRange.Picker.Common { 6 | 7 | public class RangeWeekToDate : RangeFirstDayOfWeekAware { 8 | 9 | public RangeWeekToDate(IFirstDayOfWeekProvider firstDayOfWeekProvider) : 10 | this(DateTime.Now.GetWeekFirstDate(firstDayOfWeekProvider.Value), 11 | DateTime.Now, 12 | firstDayOfWeekProvider) { 13 | } 14 | 15 | private RangeWeekToDate(DateTime from, DateTime to, IFirstDayOfWeekProvider firstDayOfWeekProvider) : base(firstDayOfWeekProvider) { 16 | From = from.Date; 17 | To = to.Date; 18 | Kind = DateRangeKind.WeekToDate; 19 | } 20 | 21 | public override IDateRange Refresh() { 22 | CleanUp(); 23 | return new RangeWeekToDate(FirstDayOfWeekProvider); 24 | } 25 | 26 | public override IDateRange GetNextRange() { 27 | var nextFirstDate = From.GetWeekLastDate(FirstDayOfWeekProvider.Value).AddDays(1); 28 | return new RangeWeekToDate(nextFirstDate, nextFirstDate.AddDays((To - From).TotalDays), FirstDayOfWeekProvider); 29 | } 30 | 31 | public override IDateRange GetPreviousRange() { 32 | var prevFirstDate = From.AddDays(-1).GetWeekFirstDate(FirstDayOfWeekProvider.Value); 33 | return new RangeWeekToDate(prevFirstDate, prevFirstDate.AddDays((To - From).TotalDays), FirstDayOfWeekProvider); 34 | } 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Common/RangeYear.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | 5 | namespace Rh.DateRange.Picker.Common { 6 | 7 | public class RangeYear : IDateRange { 8 | 9 | public DateTime From { get; } 10 | 11 | public DateTime To { get; } 12 | 13 | public RangeYear() : this(DateTime.Now) { } 14 | 15 | public RangeYear(DateTime date) { 16 | From = date.GetYearFirstDate(); 17 | To = date.GetYearLastDate(); 18 | } 19 | 20 | public DateRangeKind Kind => DateRangeKind.Year; 21 | 22 | public IDateRange Refresh() => new RangeYear(); 23 | 24 | public IDateRange GetNextRange() => new RangeYear(To.AddDays( 1)); 25 | 26 | public IDateRange GetPreviousRange() => new RangeYear(From.AddDays( - 1)); 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Common/RangeYearToDate.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | 5 | namespace Rh.DateRange.Picker.Common { 6 | public class RangeYearToDate : IDateRange { 7 | private readonly DateTime _initialTo; 8 | 9 | public DateTime From { get; } 10 | 11 | public DateTime To { get; } 12 | 13 | //public int Length => To - From + 1; 14 | 15 | public RangeYearToDate() { 16 | From = DateTime.Now.GetYearFirstDate(); 17 | _initialTo = To = DateTime.Now.Date; 18 | } 19 | 20 | private RangeYearToDate(DateTime from, DateTime initialTo) { 21 | From = from.Date; 22 | _initialTo = initialTo.Date; 23 | 24 | var initialToDayOfMonth = 25 | (2 == _initialTo.Month) && (29 == _initialTo.Day) && !DateTime.IsLeapYear(From.Year) 26 | ? 28 27 | : _initialTo.Day; 28 | 29 | To = new DateTime(From.Year, _initialTo.Month, initialToDayOfMonth); 30 | 31 | } 32 | 33 | public DateRangeKind Kind => DateRangeKind.YearToDate; 34 | 35 | 36 | public IDateRange Refresh() => new RangeYearToDate(); 37 | 38 | public IDateRange GetNextRange() { 39 | var nextFirstDate = From.GetYearLastDate().AddDays(1); 40 | return new RangeYearToDate(nextFirstDate, _initialTo); 41 | } 42 | 43 | public IDateRange GetPreviousRange() { 44 | var prevFirstDate = From.AddDays(-1).GetYearFirstDate(); 45 | return new RangeYearToDate(prevFirstDate, _initialTo); 46 | } 47 | 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Common/RangeYesterday.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | 5 | namespace Rh.DateRange.Picker.Common { 6 | 7 | public class RangeYesterday : IDateRange { 8 | public DateTime From { get; } 9 | 10 | public DateTime To { get; } 11 | 12 | public RangeYesterday() : this(DateTime.Now.AddDays(-1)) { } 13 | 14 | private RangeYesterday(DateTime dateTime) { 15 | From = To = dateTime.Date; 16 | } 17 | 18 | public DateRangeKind Kind => DateRangeKind.Yesterday; 19 | 20 | public IDateRange Refresh() => new RangeYesterday(); 21 | 22 | public IDateRange GetNextRange() => new RangeYesterday(To.AddDays(1)); 23 | 24 | public IDateRange GetPreviousRange() => new RangeYesterday(From.AddDays(-1)); 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/DateRangeValue.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | 5 | namespace Rh.DateRange.Picker { 6 | public struct DateRangeValue { 7 | public DateTime From { get; } 8 | public DateTime To { get; } 9 | 10 | public DateRangeValue(DateTime from, DateTime to) { 11 | From = from; 12 | To = to; 13 | } 14 | 15 | public override string ToString() => 16 | string.Concat(From.ToShortDateString(), " - ", To.ToShortDateString()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/FirstDayOfWeekProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | using System.ComponentModel; 5 | using System.Globalization; 6 | 7 | namespace Rh.DateRange.Picker { 8 | internal class FirstDayOfWeekProvider : IFirstDayOfWeekProvider { 9 | private DayOfWeek _firstDayOfWeek = CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek; 10 | 11 | public DayOfWeek Value { 12 | get { 13 | return _firstDayOfWeek; 14 | } 15 | set { 16 | _firstDayOfWeek = value; 17 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Value))); 18 | } 19 | } 20 | 21 | public event PropertyChangedEventHandler PropertyChanged; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/IFirstDayOfWeekProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | using System.ComponentModel; 5 | 6 | namespace Rh.DateRange.Picker { 7 | public interface IFirstDayOfWeekProvider : INotifyPropertyChanged { 8 | DayOfWeek Value { get; } 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/OrientationToSpacerSizeConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | using System.Globalization; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Data; 8 | 9 | namespace Rh.DateRange.Picker { 10 | 11 | public class OrientationToSpacerSizeConverter : IMultiValueConverter { 12 | public object Convert(object[] values, Type targetType, object targetOrientation, CultureInfo culture) { 13 | if (2 != values.Length) { throw new ArgumentException("values[]"); } 14 | 15 | if (!(values[0] is Orientation)) { throw new ArgumentException("values[0]"); } 16 | var orientation = (Orientation)values[0]; 17 | 18 | if (!(targetOrientation is Orientation)) { throw new ArgumentException(nameof(targetOrientation)); } 19 | 20 | if ((Orientation)targetOrientation == orientation) { 21 | if (!(values[1] is double)) { throw new ArgumentException("values[1] must be a double"); } 22 | return new GridLength((double)values[1]); 23 | } 24 | 25 | return new GridLength(0.0); 26 | } 27 | 28 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { 29 | return value as object[]; 30 | } 31 | 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/OrientationToTextAlignmentConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System; 4 | using System.Globalization; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Data; 8 | 9 | namespace Rh.DateRange.Picker { 10 | 11 | public class OrientationToTextAlignmentConverter : IValueConverter { 12 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { 13 | return Orientation.Horizontal == (Orientation)value ? TextAlignment.Right : TextAlignment.Left; 14 | } 15 | 16 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { 17 | return Binding.DoNothing; 18 | } 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Alexander Zhmerik. All rights reserved. 2 | // Licensed under the MIT License. See LICENSE file in the solution root for full license information. 3 | using System.Reflection; 4 | using System.Runtime.CompilerServices; 5 | using System.Runtime.InteropServices; 6 | using System.Windows; 7 | using System.Windows.Markup; 8 | 9 | // General Information about an assembly is controlled through the following 10 | // set of attributes. Change these attribute values to modify the information 11 | // associated with an assembly. 12 | [assembly: AssemblyTitle("Rh.DateRange.Picker")] 13 | [assembly: AssemblyDescription("A WPF control to provide a human-friendly way to select a date range.")] 14 | [assembly: AssemblyConfiguration("")] 15 | [assembly: AssemblyCompany("Alexander Zhmerik")] 16 | [assembly: AssemblyProduct("Rh.DateRange.Picker")] 17 | [assembly: AssemblyCopyright("Copyright © Alexander Zhmerik")] 18 | [assembly: AssemblyTrademark("")] 19 | [assembly: AssemblyCulture("")] 20 | 21 | [assembly: InternalsVisibleTo("Rh.DateRange.Picker.Tests")] 22 | 23 | // Setting ComVisible to false makes the types in this assembly not visible 24 | // to COM components. If you need to access a type in this assembly from 25 | // COM, set the ComVisible attribute to true on that type. 26 | [assembly: ComVisible(false)] 27 | 28 | //In order to begin building localizable applications, set 29 | //CultureYouAreCodingWith in your .csproj file 30 | //inside a . For example, if you are using US english 31 | //in your source files, set the to en-US. Then uncomment 32 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 33 | //the line below to match the UICulture setting in the project file. 34 | 35 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 36 | 37 | 38 | [assembly: ThemeInfo( 39 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 40 | //(used if a resource is not found in the page, 41 | // or application resource dictionaries) 42 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 43 | //(used if a resource is not found in the page, 44 | // app, or any theme specific resource dictionaries) 45 | )] 46 | 47 | 48 | // Version information for an assembly consists of the following four values: 49 | // 50 | // Major Version 51 | // Minor Version 52 | // Build Number 53 | // Revision 54 | // 55 | // You can specify all the values or you can default the Build and Revision Numbers 56 | // by using the '*' as shown below: 57 | // [assembly: AssemblyVersion("1.0.*")] 58 | [assembly: AssemblyVersion("1.0.0.0")] 59 | [assembly: AssemblyFileVersion("1.0.0.0")] 60 | [assembly: AssemblyInformationalVersion("1.0.0.0")] 61 | 62 | [assembly: XmlnsPrefix("http://schemas.rollinghours.com/wpf", "rh")] 63 | [assembly: XmlnsDefinition("http://schemas.rollinghours.com/wpf", "Rh.DateRange.Picker")] 64 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Rh.DateRange.Picker.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Rh.DateRange.Picker.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized string similar to Custom. 65 | /// 66 | internal static string Custom { 67 | get { 68 | return ResourceManager.GetString("Custom", resourceCulture); 69 | } 70 | } 71 | 72 | /// 73 | /// Looks up a localized string similar to From. 74 | /// 75 | internal static string From { 76 | get { 77 | return ResourceManager.GetString("From", resourceCulture); 78 | } 79 | } 80 | 81 | /// 82 | /// Looks up a localized string similar to Last 30 Days. 83 | /// 84 | internal static string Last30Days { 85 | get { 86 | return ResourceManager.GetString("Last30Days", resourceCulture); 87 | } 88 | } 89 | 90 | /// 91 | /// Looks up a localized string similar to Last 7 Days. 92 | /// 93 | internal static string Last7Days { 94 | get { 95 | return ResourceManager.GetString("Last7Days", resourceCulture); 96 | } 97 | } 98 | 99 | /// 100 | /// Looks up a localized string similar to Last Year. 101 | /// 102 | internal static string LastYear { 103 | get { 104 | return ResourceManager.GetString("LastYear", resourceCulture); 105 | } 106 | } 107 | 108 | /// 109 | /// Looks up a localized string similar to This Month. 110 | /// 111 | internal static string Month { 112 | get { 113 | return ResourceManager.GetString("Month", resourceCulture); 114 | } 115 | } 116 | 117 | /// 118 | /// Looks up a localized string similar to Month To Date. 119 | /// 120 | internal static string MonthToDate { 121 | get { 122 | return ResourceManager.GetString("MonthToDate", resourceCulture); 123 | } 124 | } 125 | 126 | /// 127 | /// Looks up a localized string similar to Previous Month. 128 | /// 129 | internal static string PreviousMonth { 130 | get { 131 | return ResourceManager.GetString("PreviousMonth", resourceCulture); 132 | } 133 | } 134 | 135 | /// 136 | /// Looks up a localized string similar to Previous Week. 137 | /// 138 | internal static string PreviousWeek { 139 | get { 140 | return ResourceManager.GetString("PreviousWeek", resourceCulture); 141 | } 142 | } 143 | 144 | /// 145 | /// Looks up a localized string similar to Previous Year. 146 | /// 147 | internal static string PreviousYear { 148 | get { 149 | return ResourceManager.GetString("PreviousYear", resourceCulture); 150 | } 151 | } 152 | 153 | /// 154 | /// Looks up a localized string similar to To. 155 | /// 156 | internal static string To { 157 | get { 158 | return ResourceManager.GetString("To", resourceCulture); 159 | } 160 | } 161 | 162 | /// 163 | /// Looks up a localized string similar to Today. 164 | /// 165 | internal static string Today { 166 | get { 167 | return ResourceManager.GetString("Today", resourceCulture); 168 | } 169 | } 170 | 171 | /// 172 | /// Looks up a localized string similar to This Week. 173 | /// 174 | internal static string Week { 175 | get { 176 | return ResourceManager.GetString("Week", resourceCulture); 177 | } 178 | } 179 | 180 | /// 181 | /// Looks up a localized string similar to Week To Date. 182 | /// 183 | internal static string WeekToDate { 184 | get { 185 | return ResourceManager.GetString("WeekToDate", resourceCulture); 186 | } 187 | } 188 | 189 | /// 190 | /// Looks up a localized string similar to This Year. 191 | /// 192 | internal static string Year { 193 | get { 194 | return ResourceManager.GetString("Year", resourceCulture); 195 | } 196 | } 197 | 198 | /// 199 | /// Looks up a localized string similar to Year To Date. 200 | /// 201 | internal static string YearToDate { 202 | get { 203 | return ResourceManager.GetString("YearToDate", resourceCulture); 204 | } 205 | } 206 | } 207 | } 208 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Custom 122 | 123 | 124 | From 125 | 126 | 127 | Last 30 Days 128 | 129 | 130 | Last 7 Days 131 | 132 | 133 | Last Year 134 | 135 | 136 | This Month 137 | 138 | 139 | Month To Date 140 | 141 | 142 | Previous Month 143 | 144 | 145 | Previous Week 146 | 147 | 148 | Previous Year 149 | 150 | 151 | To 152 | 153 | 154 | Today 155 | 156 | 157 | This Week 158 | 159 | 160 | Week To Date 161 | 162 | 163 | This Year 164 | 165 | 166 | Year To Date 167 | 168 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Properties/Resources.ru-RU.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Произвольный 122 | 123 | 124 | С 125 | 126 | 127 | Последние 30 дней 128 | 129 | 130 | Последние 7 дней 131 | 132 | 133 | Прошедший год 134 | 135 | 136 | Месяц 137 | 138 | 139 | Месяц до сегодня 140 | 141 | 142 | Предыдущий месяц 143 | 144 | 145 | Предыдущая неделя 146 | 147 | 148 | Предыдущий год 149 | 150 | 151 | По 152 | 153 | 154 | Сегодня 155 | 156 | 157 | Неделя 158 | 159 | 160 | Неделя до сегодня 161 | 162 | 163 | Год 164 | 165 | 166 | Год до сегодня 167 | 168 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Rh.DateRange.Picker.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Resources/Resource.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Rh.DateRange.Picker.Resources { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resource { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resource() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Rh.DateRange.Picker.Resources.Resource", typeof(Resource).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized string similar to Custom. 65 | /// 66 | internal static string Custom { 67 | get { 68 | return ResourceManager.GetString("Custom", resourceCulture); 69 | } 70 | } 71 | 72 | /// 73 | /// Looks up a localized string similar to From. 74 | /// 75 | internal static string From { 76 | get { 77 | return ResourceManager.GetString("From", resourceCulture); 78 | } 79 | } 80 | 81 | /// 82 | /// Looks up a localized string similar to Last 30 Days. 83 | /// 84 | internal static string Last30Days { 85 | get { 86 | return ResourceManager.GetString("Last30Days", resourceCulture); 87 | } 88 | } 89 | 90 | /// 91 | /// Looks up a localized string similar to Last 7 Days. 92 | /// 93 | internal static string Last7Days { 94 | get { 95 | return ResourceManager.GetString("Last7Days", resourceCulture); 96 | } 97 | } 98 | 99 | /// 100 | /// Looks up a localized string similar to Last Month. 101 | /// 102 | internal static string LastMonth { 103 | get { 104 | return ResourceManager.GetString("LastMonth", resourceCulture); 105 | } 106 | } 107 | 108 | /// 109 | /// Looks up a localized string similar to Last Week. 110 | /// 111 | internal static string LastWeek { 112 | get { 113 | return ResourceManager.GetString("LastWeek", resourceCulture); 114 | } 115 | } 116 | 117 | /// 118 | /// Looks up a localized string similar to Last Year. 119 | /// 120 | internal static string LastYear { 121 | get { 122 | return ResourceManager.GetString("LastYear", resourceCulture); 123 | } 124 | } 125 | 126 | /// 127 | /// Looks up a localized string similar to This Month. 128 | /// 129 | internal static string Month { 130 | get { 131 | return ResourceManager.GetString("Month", resourceCulture); 132 | } 133 | } 134 | 135 | /// 136 | /// Looks up a localized string similar to Month To Date. 137 | /// 138 | internal static string MonthToDate { 139 | get { 140 | return ResourceManager.GetString("MonthToDate", resourceCulture); 141 | } 142 | } 143 | 144 | /// 145 | /// Looks up a localized string similar to The Last Year. 146 | /// 147 | internal static string TheLastYear { 148 | get { 149 | return ResourceManager.GetString("TheLastYear", resourceCulture); 150 | } 151 | } 152 | 153 | /// 154 | /// Looks up a localized string similar to To. 155 | /// 156 | internal static string To { 157 | get { 158 | return ResourceManager.GetString("To", resourceCulture); 159 | } 160 | } 161 | 162 | /// 163 | /// Looks up a localized string similar to Today. 164 | /// 165 | internal static string Today { 166 | get { 167 | return ResourceManager.GetString("Today", resourceCulture); 168 | } 169 | } 170 | 171 | /// 172 | /// Looks up a localized string similar to This Week. 173 | /// 174 | internal static string Week { 175 | get { 176 | return ResourceManager.GetString("Week", resourceCulture); 177 | } 178 | } 179 | 180 | /// 181 | /// Looks up a localized string similar to Week To Date. 182 | /// 183 | internal static string WeekToDate { 184 | get { 185 | return ResourceManager.GetString("WeekToDate", resourceCulture); 186 | } 187 | } 188 | 189 | /// 190 | /// Looks up a localized string similar to This Year. 191 | /// 192 | internal static string Year { 193 | get { 194 | return ResourceManager.GetString("Year", resourceCulture); 195 | } 196 | } 197 | 198 | /// 199 | /// Looks up a localized string similar to Year To Date. 200 | /// 201 | internal static string YearToDate { 202 | get { 203 | return ResourceManager.GetString("YearToDate", resourceCulture); 204 | } 205 | } 206 | 207 | /// 208 | /// Looks up a localized string similar to Yesterday. 209 | /// 210 | internal static string Yesterday { 211 | get { 212 | return ResourceManager.GetString("Yesterday", resourceCulture); 213 | } 214 | } 215 | } 216 | } 217 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Resources/Resource.de.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Benutzerdefiniert 122 | 123 | 124 | Von 125 | 126 | 127 | Letzte 30 Tage 128 | 129 | 130 | Letzte 7 Tage 131 | 132 | 133 | Diesen Monat 134 | 135 | 136 | Monat zu Datum 137 | 138 | 139 | Vorheriger Monat 140 | 141 | 142 | Vorherige Woche 143 | 144 | 145 | Vorheriges Jahr 146 | 147 | 148 | Letztes Jahr 149 | 150 | 151 | bis 152 | 153 | 154 | Heute 155 | 156 | 157 | Diese Woche 158 | 159 | 160 | Woche zu Datum 161 | 162 | 163 | Dieses Jahr 164 | 165 | 166 | Jahr zu Datum 167 | 168 | 169 | Gestern 170 | 171 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Resources/Resource.es.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Personalizado 122 | 123 | 124 | De 125 | 126 | 127 | Últimos 30 días 128 | 129 | 130 | Últimos 7 días 131 | 132 | 133 | Este mes 134 | 135 | 136 | Un mes desde la fecha 137 | 138 | 139 | Mes anterior 140 | 141 | 142 | Semana anterior 143 | 144 | 145 | Año anterior 146 | 147 | 148 | Último año 149 | 150 | 151 | a 152 | 153 | 154 | Hoy 155 | 156 | 157 | Esta semana 158 | 159 | 160 | Un semana desde la fecha 161 | 162 | 163 | Este año 164 | 165 | 166 | Un año desde la fecha 167 | 168 | 169 | Ayer 170 | 171 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Resources/Resource.fr.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Personnalisé 122 | 123 | 124 | Du 125 | 126 | 127 | 30 derniers jours 128 | 129 | 130 | 7 derniers jours 131 | 132 | 133 | Mois en cours 134 | 135 | 136 | Depuis début mois 137 | 138 | 139 | Mois précédent 140 | 141 | 142 | Semaine précédente 143 | 144 | 145 | Année précédente 146 | 147 | 148 | Année dernière 149 | 150 | 151 | au 152 | 153 | 154 | Aujourd'hui 155 | 156 | 157 | Semaine en cours 158 | 159 | 160 | Depuis début semaine 161 | 162 | 163 | Année en cours 164 | 165 | 166 | Depuis début année 167 | 168 | 169 | Hier 170 | 171 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Resources/Resource.it.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Personalizzato 122 | 123 | 124 | Da 125 | 126 | 127 | Ultimi 30 giorni 128 | 129 | 130 | Ultimi 7 giorni 131 | 132 | 133 | Questo mese 134 | 135 | 136 | Da inizio mese 137 | 138 | 139 | Mese scorso 140 | 141 | 142 | Settimana scorsa 143 | 144 | 145 | Mese scorso 146 | 147 | 148 | Anno precedente 149 | 150 | 151 | a 152 | 153 | 154 | Oggi 155 | 156 | 157 | Questa settimana 158 | 159 | 160 | Da inizio settimana 161 | 162 | 163 | Quest'anno 164 | 165 | 166 | Da inizio anno 167 | 168 | 169 | Ieri 170 | 171 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Resources/Resource.pl.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Użytkownika 122 | 123 | 124 | Od 125 | 126 | 127 | Ostatnie 30 dni 128 | 129 | 130 | Ostatnie 7 dni 131 | 132 | 133 | Ten miesiąc 134 | 135 | 136 | Aktualny miesiąc 137 | 138 | 139 | Poprzedni miesiąc 140 | 141 | 142 | Poprzedni tydzień 143 | 144 | 145 | Poprzedni rok 146 | 147 | 148 | Ostatni rok 149 | 150 | 151 | do 152 | 153 | 154 | Dzisiaj 155 | 156 | 157 | Ten tydzień 158 | 159 | 160 | Aktualny tydzień 161 | 162 | 163 | Ten rok 164 | 165 | 166 | Aktualny rok 167 | 168 | 169 | Wczoraj 170 | 171 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Resources/Resource.pt.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Personalizado 122 | 123 | 124 | De 125 | 126 | 127 | Últimos 30 dias 128 | 129 | 130 | Últimos 7 dias 131 | 132 | 133 | Este mês 134 | 135 | 136 | Mês até à data 137 | 138 | 139 | Mês anterior 140 | 141 | 142 | Semana anterior 143 | 144 | 145 | Ano anterior 146 | 147 | 148 | Último ano 149 | 150 | 151 | a 152 | 153 | 154 | Hoje 155 | 156 | 157 | Esta semana 158 | 159 | 160 | Semana até à data 161 | 162 | 163 | Este ano 164 | 165 | 166 | Ano até à data 167 | 168 | 169 | Ontem 170 | 171 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Resources/Resource.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Custom 122 | 123 | 124 | From 125 | 126 | 127 | Last 30 Days 128 | 129 | 130 | Last 7 Days 131 | 132 | 133 | This Month 134 | 135 | 136 | Month To Date 137 | 138 | 139 | Last Month 140 | 141 | 142 | Last Week 143 | 144 | 145 | Last Year 146 | 147 | 148 | The Last Year 149 | 150 | 151 | To 152 | 153 | 154 | Today 155 | 156 | 157 | This Week 158 | 159 | 160 | Week To Date 161 | 162 | 163 | This Year 164 | 165 | 166 | Year To Date 167 | 168 | 169 | Yesterday 170 | 171 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Resources/Resource.ru.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Произвольный 122 | 123 | 124 | С 125 | 126 | 127 | Последние 30 дней 128 | 129 | 130 | Последние 7 дней 131 | 132 | 133 | Месяц 134 | 135 | 136 | С начала месяца 137 | 138 | 139 | Предыдущий месяц 140 | 141 | 142 | Предыдущая неделя 143 | 144 | 145 | Предыдущий год 146 | 147 | 148 | Прошедший год 149 | 150 | 151 | по 152 | 153 | 154 | Сегодня 155 | 156 | 157 | Неделя 158 | 159 | 160 | С начала недели 161 | 162 | 163 | Год 164 | 165 | 166 | С начала года 167 | 168 | 169 | Вчера 170 | 171 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Rh.DateRange.Picker.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {96416AAD-BC52-46AA-BB24-3AFF91FC5473} 8 | library 9 | Properties 10 | Rh.DateRange.Picker 11 | Rh.DateRange.Picker 12 | v4.0 13 | 512 14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 15 | 4 16 | 17 | 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | true 26 | 27 | 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 4.0 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | True 79 | True 80 | Resource.resx 81 | 82 | 83 | 84 | 85 | MSBuild:Compile 86 | Designer 87 | 88 | 89 | Code 90 | 91 | 92 | 93 | 94 | 95 | 96 | Code 97 | 98 | 99 | True 100 | Settings.settings 101 | True 102 | 103 | 104 | DateRangeControl.licenseheader 105 | 106 | 107 | SettingsSingleFileGenerator 108 | Settings.Designer.cs 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | ResXFileCodeGenerator 122 | Resource.Designer.cs 123 | 124 | 125 | 126 | 127 | 134 | -------------------------------------------------------------------------------- /Rh.DateRange.Picker/Rh.DateRange.Picker.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $id$ 5 | $version$ 6 | $title$ 7 | $author$ 8 | $author$ 9 | MIT 10 | https://github.com/rollinghours/DateRangeControl 11 | false 12 | $description$ 13 | Updated copyright notice 14 | Copyright $author$ 15 | wpf date range span picker control 16 | 17 | -------------------------------------------------------------------------------- /docs/DateRangePickerHorizontal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollinghours/DateRangeControl/de9d1b33666c6efb74147e882033bd4a94222aa3/docs/DateRangePickerHorizontal.png -------------------------------------------------------------------------------- /docs/DateRangePickerVertical.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rollinghours/DateRangeControl/de9d1b33666c6efb74147e882033bd4a94222aa3/docs/DateRangePickerVertical.png --------------------------------------------------------------------------------