├── .gitattributes
├── .gitignore
├── Digimezzo.WPFControls.Tests
├── App.config
├── App.xaml
├── App.xaml.cs
├── Digimezzo.WPFControls.Tests.csproj
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
└── Tests
│ ├── BorderlessWindows10WindowTest.xaml
│ ├── BorderlessWindows10WindowTest.xaml.cs
│ ├── BorderlessWindows8WindowTest.xaml
│ ├── BorderlessWindows8WindowTest.xaml.cs
│ ├── CS.bmp
│ ├── ColorPickerTest.xaml
│ ├── ColorPickerTest.xaml.cs
│ ├── LabelTest.xaml
│ ├── LabelTest.xaml.cs
│ ├── MaterialControlsTest.xaml
│ ├── MaterialControlsTest.xaml.cs
│ ├── MultiPanePanelTest.xaml
│ ├── MultiPanePanelTest.xaml.cs
│ ├── MultiSelectListBoxTest.xaml
│ ├── MultiSelectListBoxTest.xaml.cs
│ ├── PivotTest.xaml
│ ├── PivotTest.xaml.cs
│ ├── ProgressRingTest.xaml
│ ├── ProgressRingTest.xaml.cs
│ ├── RippleDecoratorTest.xaml
│ ├── RippleDecoratorTest.xaml.cs
│ ├── RippleTest.xaml
│ ├── RippleTest.xaml.cs
│ ├── SlidingContentControlTest.xaml
│ ├── SlidingContentControlTest.xaml.cs
│ ├── SplitViewTest.xaml
│ ├── SplitViewTest.xaml.cs
│ ├── ToggleSwitchTest.xaml
│ ├── ToggleSwitchTest.xaml.cs
│ ├── UWPSliderTest.xaml
│ ├── UWPSliderTest.xaml.cs
│ ├── VirtualizingWrapPanelTest.xaml
│ ├── VirtualizingWrapPanelTest.xaml.cs
│ ├── Windows10SliderTest.xaml
│ ├── Windows10SliderTest.xaml.cs
│ ├── Windows8SliderTest.xaml
│ └── Windows8SliderTest.xaml.cs
├── Digimezzo.WPFControls
├── Base
│ ├── BorderlessWindowBase.cs
│ ├── Constants.cs
│ ├── PropertyChangedBase.cs
│ └── SliderBase.cs
├── BorderlessWindows10Window.cs
├── BorderlessWindows8Window.cs
├── ColorPicker.cs
├── Converters
│ ├── AddValueConverter.cs
│ ├── BooleanToCollapsedConverter.cs
│ ├── BooleanToVisibilityConverter.cs
│ ├── ColorToSolidColorBrushConverter.cs
│ ├── IntRatioConverter.cs
│ ├── InvertingBooleanConverter.cs
│ ├── NullToCollapsedConverter.cs
│ ├── NullToVisibleConverter.cs
│ ├── ResizeModeMinMaxButtonVisibilityConverter.cs
│ ├── SolidColorBrushToColorConverter.cs
│ ├── StringToLowerConverter.cs
│ └── StringToUpperConverter.cs
├── Digimezzo.WPFControls.csproj
├── Effects
│ ├── FeatheringEffect.cs
│ ├── FeatheringEffect.fx
│ ├── FeatheringEffect.ps
│ ├── HsvWheelEffect.cs
│ ├── HsvWheelEffect.fx
│ └── HsvWheelEffect.ps
├── Enums
│ ├── SlideDirection.cs
│ └── WrapPanelAlignment.cs
├── Extensions
│ └── StringExtensions.cs
├── LabelToLower.cs
├── LabelToUpper.cs
├── Licenses
│ ├── Gu.Wpf.Geometry.txt
│ ├── MahApps.Metro.txt
│ └── PropertyTools.txt
├── MaterialButtons.cs
├── MaterialComboBox.cs
├── MaterialDateBox.cs
├── MaterialTextBox.cs
├── MaterialToggleSwitch.cs
├── MultiPanePanel.cs
├── MultiSelectListBox.cs
├── Native
│ ├── AppBar
│ │ ├── Enums.cs
│ │ ├── NativeMethods.cs
│ │ └── Structs.cs
│ ├── Constants.cs
│ ├── Monitor
│ │ ├── Constants.cs
│ │ ├── NativeMethods.cs
│ │ └── Structs.cs
│ └── NativeMethods.cs
├── PageIndicator.cs
├── Pivot.cs
├── ProgressRing.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Ripple.cs
├── SharedAssemblyInfo.cs
├── SlidingContentControl.cs
├── SplitView.cs
├── Themes
│ ├── BorderlessWindows10Window.xaml
│ ├── BorderlessWindows8Window.xaml
│ ├── ColorPicker.xaml
│ ├── Generic.xaml
│ ├── LabelToLower.xaml
│ ├── LabelToUpper.xaml
│ ├── MaterialButtons.xaml
│ ├── MaterialComboBox.xaml
│ ├── MaterialDateBox.xaml
│ ├── MaterialTextBox.xaml
│ ├── MaterialToggleSwitch.xaml
│ ├── MultiPanePanel.xaml
│ ├── PageIndicator.xaml
│ ├── Pivot.xaml
│ ├── ProgressRing.xaml
│ ├── Ripple.xaml
│ ├── SlidingContentControl.xaml
│ ├── SplitView.xaml
│ ├── ToggleSwitch.xaml
│ ├── UwpSlider.xaml
│ ├── Windows10Slider.xaml
│ ├── Windows10ToggleSwitch.xaml
│ └── Windows8Slider.xaml
├── ToggleSwitch.cs
├── UWPSlider.cs
├── Utils
│ ├── AnimationUtils.cs
│ ├── UriUtils.cs
│ └── VisualTreeUtils.cs
├── UwpSlider.cs
├── ValidationRules
│ ├── IntValidation.cs
│ └── RegexValidation.cs
├── VirtualizingWrapPanel.cs
├── Windows10Slider.cs
├── Windows10ToggleSwitch.cs
└── Windows8Slider.cs
├── LICENSE
├── README.md
└── WPFControls.sln
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | artifacts/
46 |
47 | *_i.c
48 | *_p.c
49 | *_i.h
50 | *.ilk
51 | *.meta
52 | *.obj
53 | *.pch
54 | *.pdb
55 | *.pgc
56 | *.pgd
57 | *.rsp
58 | *.sbr
59 | *.tlb
60 | *.tli
61 | *.tlh
62 | *.tmp
63 | *.tmp_proj
64 | *.log
65 | *.vspscc
66 | *.vssscc
67 | .builds
68 | *.pidb
69 | *.svclog
70 | *.scc
71 |
72 | # Chutzpah Test files
73 | _Chutzpah*
74 |
75 | # Visual C++ cache files
76 | ipch/
77 | *.aps
78 | *.ncb
79 | *.opendb
80 | *.opensdf
81 | *.sdf
82 | *.cachefile
83 | *.VC.db
84 | *.VC.VC.opendb
85 |
86 | # Visual Studio profiler
87 | *.psess
88 | *.vsp
89 | *.vspx
90 | *.sap
91 |
92 | # TFS 2012 Local Workspace
93 | $tf/
94 |
95 | # Guidance Automation Toolkit
96 | *.gpState
97 |
98 | # ReSharper is a .NET coding add-in
99 | _ReSharper*/
100 | *.[Rr]e[Ss]harper
101 | *.DotSettings.user
102 |
103 | # JustCode is a .NET coding add-in
104 | .JustCode
105 |
106 | # TeamCity is a build add-in
107 | _TeamCity*
108 |
109 | # DotCover is a Code Coverage Tool
110 | *.dotCover
111 |
112 | # NCrunch
113 | _NCrunch_*
114 | .*crunch*.local.xml
115 | nCrunchTemp_*
116 |
117 | # MightyMoose
118 | *.mm.*
119 | AutoTest.Net/
120 |
121 | # Web workbench (sass)
122 | .sass-cache/
123 |
124 | # Installshield output folder
125 | [Ee]xpress/
126 |
127 | # DocProject is a documentation generator add-in
128 | DocProject/buildhelp/
129 | DocProject/Help/*.HxT
130 | DocProject/Help/*.HxC
131 | DocProject/Help/*.hhc
132 | DocProject/Help/*.hhk
133 | DocProject/Help/*.hhp
134 | DocProject/Help/Html2
135 | DocProject/Help/html
136 |
137 | # Click-Once directory
138 | publish/
139 |
140 | # Publish Web Output
141 | *.[Pp]ublish.xml
142 | *.azurePubxml
143 | # TODO: Comment the next line if you want to checkin your web deploy settings
144 | # but database connection strings (with potential passwords) will be unencrypted
145 | *.pubxml
146 | *.publishproj
147 |
148 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
149 | # checkin your Azure Web App publish settings, but sensitive information contained
150 | # in these scripts will be unencrypted
151 | PublishScripts/
152 |
153 | # NuGet Packages
154 | *.nupkg
155 | # The packages folder can be ignored because of Package Restore
156 | **/packages/*
157 | # except build/, which is used as an MSBuild target.
158 | !**/packages/build/
159 | # Uncomment if necessary however generally it will be regenerated when needed
160 | #!**/packages/repositories.config
161 | # NuGet v3's project.json files produces more ignoreable files
162 | *.nuget.props
163 | *.nuget.targets
164 |
165 | # Microsoft Azure Build Output
166 | csx/
167 | *.build.csdef
168 |
169 | # Microsoft Azure Emulator
170 | ecf/
171 | rcf/
172 |
173 | # Windows Store app package directories and files
174 | AppPackages/
175 | BundleArtifacts/
176 | Package.StoreAssociation.xml
177 | _pkginfo.txt
178 |
179 | # Visual Studio cache files
180 | # files ending in .cache can be ignored
181 | *.[Cc]ache
182 | # but keep track of directories ending in .cache
183 | !*.[Cc]ache/
184 |
185 | # Others
186 | ClientBin/
187 | ~$*
188 | *~
189 | *.dbmdl
190 | *.dbproj.schemaview
191 | *.pfx
192 | *.publishsettings
193 | node_modules/
194 | orleans.codegen.cs
195 |
196 | # Since there are multiple workflows, uncomment next line to ignore bower_components
197 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
198 | #bower_components/
199 |
200 | # RIA/Silverlight projects
201 | Generated_Code/
202 |
203 | # Backup & report files from converting an old project file
204 | # to a newer Visual Studio version. Backup files are not needed,
205 | # because we have git ;-)
206 | _UpgradeReport_Files/
207 | Backup*/
208 | UpgradeLog*.XML
209 | UpgradeLog*.htm
210 |
211 | # SQL Server files
212 | *.mdf
213 | *.ldf
214 |
215 | # Business Intelligence projects
216 | *.rdl.data
217 | *.bim.layout
218 | *.bim_*.settings
219 |
220 | # Microsoft Fakes
221 | FakesAssemblies/
222 |
223 | # GhostDoc plugin setting file
224 | *.GhostDoc.xml
225 |
226 | # Node.js Tools for Visual Studio
227 | .ntvs_analysis.dat
228 |
229 | # Visual Studio 6 build log
230 | *.plg
231 |
232 | # Visual Studio 6 workspace options file
233 | *.opt
234 |
235 | # Visual Studio LightSwitch build output
236 | **/*.HTMLClient/GeneratedArtifacts
237 | **/*.DesktopClient/GeneratedArtifacts
238 | **/*.DesktopClient/ModelManifest.xml
239 | **/*.Server/GeneratedArtifacts
240 | **/*.Server/ModelManifest.xml
241 | _Pvt_Extensions
242 |
243 | # Paket dependency manager
244 | .paket/paket.exe
245 | paket-files/
246 |
247 | # FAKE - F# Make
248 | .fake/
249 |
250 | # JetBrains Rider
251 | .idea/
252 | *.sln.iml
253 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace Digimezzo.WPFControls.Tests
10 | {
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using Digimezzo.WPFControls.Tests.Tests;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using System.Windows.Documents;
11 | using System.Windows.Input;
12 | using System.Windows.Media;
13 | using System.Windows.Media.Imaging;
14 | using System.Windows.Navigation;
15 | using System.Windows.Shapes;
16 |
17 | namespace Digimezzo.WPFControls.Tests
18 | {
19 | ///
20 | /// Interaction logic for MainWindow.xaml
21 | ///
22 | public partial class MainWindow : Window
23 | {
24 | public MainWindow()
25 | {
26 | InitializeComponent();
27 | }
28 |
29 | private void BorderlessWindows8WindowTestButton_Click(object sender, RoutedEventArgs e)
30 | {
31 | var win = new BorderlessWindows8WindowTest();
32 | win.Show();
33 | }
34 |
35 | private void BorderlessWindows10WindowTestButton_Click(object sender, RoutedEventArgs e)
36 | {
37 | var win = new BorderlessWindows10WindowTest();
38 | win.Show();
39 | }
40 |
41 | private void LabelTestButton_Click(object sender, RoutedEventArgs e)
42 | {
43 | var win = new LabelTest();
44 | win.Show();
45 | }
46 |
47 | private void Windows8SliderTestButton_Click(object sender, RoutedEventArgs e)
48 | {
49 | var win = new Windows8SliderTest();
50 | win.Show();
51 | }
52 |
53 | private void Windows10SliderTestButton_Click(object sender, RoutedEventArgs e)
54 | {
55 | var win = new Windows10SliderTest();
56 | win.Show();
57 | }
58 |
59 | private void UWPSliderTestButton_Click(object sender, RoutedEventArgs e)
60 | {
61 | var win = new UWPSliderTest();
62 | win.Show();
63 | }
64 |
65 | private void MultiPanePanelTestButton_Click(object sender, RoutedEventArgs e)
66 | {
67 | var win = new MultiPanePanelTest();
68 | win.Show();
69 | }
70 |
71 | private void MultiSelectListBoxTestButton_Click(object sender, RoutedEventArgs e)
72 | {
73 | var win = new MultiSelectListBoxTest();
74 | win.Show();
75 | }
76 |
77 | private void ProgressRingTestButton_Click(object sender, RoutedEventArgs e)
78 | {
79 | var win = new ProgressRingTest();
80 | win.Show();
81 | }
82 |
83 | private void SlidingContentControlTestButton_Click(object sender, RoutedEventArgs e)
84 | {
85 | var win = new SlidingContentControlTest();
86 | win.Show();
87 | }
88 |
89 | private void ToggleSwitchTestButton_Click(object sender, RoutedEventArgs e)
90 | {
91 | var win = new ToggleSwitchTest();
92 | win.Show();
93 | }
94 |
95 | private void VirtualizingWrapPanelTestButton_Click(object sender, RoutedEventArgs e)
96 | {
97 | var win = new VirtualizingWrapPanelTest();
98 | win.Show();
99 | }
100 |
101 | private void PivotTestButton_Click(object sender, RoutedEventArgs e)
102 | {
103 | var win = new PivotTest();
104 | win.Show();
105 | }
106 |
107 | private void RippleTestButton_Click(object sender, RoutedEventArgs e)
108 | {
109 | var win = new RippleTest();
110 | win.Show();
111 | }
112 |
113 | private void SplitViewTestButton_Click(object sender, RoutedEventArgs e)
114 | {
115 | var win = new SplitViewTest();
116 | win.Show();
117 | }
118 |
119 | private void MaterialControlsTestButton_Click(object sender, RoutedEventArgs e)
120 | {
121 | var win = new MaterialControlsTest();
122 | win.Show();
123 | }
124 |
125 | private void ColorPickerTestButton_Click(object sender, RoutedEventArgs e)
126 | {
127 | var win = new ColorPickerTest();
128 | win.Show();
129 | }
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("Digimezzo.WPFControls.Tests")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("Digimezzo.WPFControls.Tests")]
15 | [assembly: AssemblyCopyright("Copyright © 2016")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/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 Digimezzo.WPFControls.Tests.Properties
12 | {
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 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Returns the cached ResourceManager instance used by this class.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Digimezzo.WPFControls.Tests.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Overrides the current thread's CurrentUICulture property for all
56 | /// resource lookups using this strongly typed resource class.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/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 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/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 Digimezzo.WPFControls.Tests.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 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/BorderlessWindows10WindowTest.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/BorderlessWindows10WindowTest.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace Digimezzo.WPFControls.Tests.Tests
2 | {
3 | public partial class BorderlessWindows10WindowTest : BorderlessWindows10Window
4 | {
5 | public BorderlessWindows10WindowTest()
6 | {
7 | InitializeComponent();
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/BorderlessWindows8WindowTest.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/BorderlessWindows8WindowTest.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace Digimezzo.WPFControls.Tests.Tests
2 | {
3 | public partial class BorderlessWindows8WindowTest : BorderlessWindows8Window
4 | {
5 | public BorderlessWindows8WindowTest()
6 | {
7 | InitializeComponent();
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/CS.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/digimezzo/WPFControls/ccab6272ef4a76ce2496da616e52fa04a6fc70d9/Digimezzo.WPFControls.Tests/Tests/CS.bmp
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/ColorPickerTest.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/ColorPickerTest.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Shapes;
14 |
15 | namespace Digimezzo.WPFControls.Tests.Tests
16 | {
17 | ///
18 | /// Interaction logic for ColorPickerTest.xaml
19 | ///
20 | public partial class ColorPickerTest : Window
21 | {
22 | public ColorPickerTest()
23 | {
24 | InitializeComponent();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/LabelTest.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/LabelTest.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace Digimezzo.WPFControls.Tests.Tests
4 | {
5 | public partial class LabelTest : Window
6 | {
7 | public LabelTest()
8 | {
9 | InitializeComponent();
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/MaterialControlsTest.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
18 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/MaterialControlsTest.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Shapes;
14 |
15 | namespace Digimezzo.WPFControls.Tests.Tests
16 | {
17 | ///
18 | /// Interaction logic for MaterialControlsTest.xaml
19 | ///
20 | public partial class MaterialControlsTest : Window
21 | {
22 | public MaterialControlsTest()
23 | {
24 | InitializeComponent();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/MultiPanePanelTest.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/MultiPanePanelTest.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Shapes;
14 |
15 | namespace Digimezzo.WPFControls.Tests.Tests
16 | {
17 | ///
18 | /// Interaction logic for MultiPanePanelTest.xaml
19 | ///
20 | public partial class MultiPanePanelTest : Window
21 | {
22 | public MultiPanePanelTest()
23 | {
24 | InitializeComponent();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/MultiSelectListBoxTest.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/MultiSelectListBoxTest.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Shapes;
14 |
15 | namespace Digimezzo.WPFControls.Tests.Tests
16 | {
17 | ///
18 | /// Interaction logic for MultiSelectListBoxTest.xaml
19 | ///
20 | public partial class MultiSelectListBoxTest : Window
21 | {
22 | public MultiSelectListBoxTest()
23 | {
24 | InitializeComponent();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/PivotTest.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 | Content 1
14 |
15 |
16 | Content 2
17 |
18 |
19 | Content 3
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/PivotTest.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Shapes;
14 |
15 | namespace Digimezzo.WPFControls.Tests.Tests
16 | {
17 | ///
18 | /// Interaction logic for PivotTest.xaml
19 | ///
20 | public partial class PivotTest : Window
21 | {
22 | public PivotTest()
23 | {
24 | InitializeComponent();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/ProgressRingTest.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/ProgressRingTest.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace Digimezzo.WPFControls.Tests.Tests
4 | {
5 | public partial class ProgressRingTest : Window
6 | {
7 | public ProgressRingTest()
8 | {
9 | InitializeComponent();
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/RippleDecoratorTest.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/RippleDecoratorTest.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Shapes;
14 |
15 | namespace Digimezzo.WPFControls.Tests.Tests
16 | {
17 | ///
18 | /// Interaction logic for RippleDecoratorTest.xaml
19 | ///
20 | public partial class RippleDecoratorTest : Window
21 | {
22 | public RippleDecoratorTest()
23 | {
24 | InitializeComponent();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/RippleTest.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
37 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/RippleTest.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Shapes;
14 |
15 | namespace Digimezzo.WPFControls.Tests.Tests
16 | {
17 | ///
18 | /// Interaction logic for RippleTest.xaml
19 | ///
20 | public partial class RippleTest : Window
21 | {
22 | public RippleTest()
23 | {
24 | InitializeComponent();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/SlidingContentControlTest.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/SlidingContentControlTest.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls;
3 | using System.Windows.Media;
4 |
5 | namespace Digimezzo.WPFControls.Tests.Tests
6 | {
7 | public partial class SlidingContentControlTest : Window
8 | {
9 | public SlidingContentControlTest()
10 | {
11 | InitializeComponent();
12 | }
13 |
14 | private void Content1Button_Click(object sender, RoutedEventArgs e)
15 | {
16 | var border = new Border();
17 | border.Background = Brushes.Red;
18 |
19 | ContentControl.SlideDirection = Enums.SlideDirection.LeftToRight;
20 | ContentControl.Content = border;
21 | }
22 |
23 | private void Content2Button_Click(object sender, RoutedEventArgs e)
24 | {
25 | var border = new Border();
26 | border.Background = Brushes.Green;
27 |
28 | ContentControl.SlideDirection = Enums.SlideDirection.RightToLeft;
29 | ContentControl.EasingAmplitude = 0;
30 | ContentControl.Content = border;
31 | }
32 |
33 | private void Content3Button_Click(object sender, RoutedEventArgs e)
34 | {
35 | var border = new Border();
36 | border.Background = Brushes.Blue;
37 |
38 | ContentControl.SlideDirection = Enums.SlideDirection.LeftToRight;
39 | ContentControl.EasingAmplitude = 0;
40 | ContentControl.Duration = 1.0;
41 | ContentControl.SlideFadeIn = true;
42 | ContentControl.SlideFadeInDuration = 1;
43 | ContentControl.Content = border;
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/SplitViewTest.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/SplitViewTest.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace Digimezzo.WPFControls.Tests.Tests
4 | {
5 | public partial class SplitViewTest : Window
6 | {
7 | public SplitViewTest()
8 | {
9 | InitializeComponent();
10 | }
11 |
12 | private void Button_Click(object sender, RoutedEventArgs e)
13 | {
14 | this.MySplitView.IsPaneOpen = !this.MySplitView.IsPaneOpen;
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/ToggleSwitchTest.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/ToggleSwitchTest.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Shapes;
14 |
15 | namespace Digimezzo.WPFControls.Tests.Tests
16 | {
17 | ///
18 | /// Interaction logic for ToggleSwitchTest.xaml
19 | ///
20 | public partial class ToggleSwitchTest : Window
21 | {
22 | public ToggleSwitchTest()
23 | {
24 | InitializeComponent();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/UWPSliderTest.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/UWPSliderTest.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace Digimezzo.WPFControls.Tests.Tests
4 | {
5 | public partial class UWPSliderTest : Window
6 | {
7 | public UWPSliderTest()
8 | {
9 | InitializeComponent();
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/VirtualizingWrapPanelTest.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/VirtualizingWrapPanelTest.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.ObjectModel;
3 | using System.Windows;
4 | using System.Windows.Controls;
5 | using System.Windows.Media.Imaging;
6 |
7 | namespace Digimezzo.WPFControls.Tests.Tests
8 | {
9 | ///
10 | /// Interaction logic for VirtualizingWrapPanelTest.xaml
11 | ///
12 | public partial class VirtualizingWrapPanelTest : Window
13 | {
14 | public VirtualizingWrapPanelTest()
15 | {
16 | InitializeComponent();
17 |
18 | var images = new ObservableCollection();
19 |
20 | for (int i = 0; i < 50000; i++)
21 | {
22 | var im = new Image();
23 | im.Source = new BitmapImage(new Uri("CS.bmp", UriKind.Relative));
24 | im.Width = 90;
25 | im.Height = 110;
26 | images.Add(im);
27 | }
28 |
29 | Box.ItemsSource = images;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/Windows10SliderTest.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/Windows10SliderTest.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace Digimezzo.WPFControls.Tests.Tests
4 | {
5 | public partial class Windows10SliderTest : Window
6 | {
7 | public Windows10SliderTest()
8 | {
9 | InitializeComponent();
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/Windows8SliderTest.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls.Tests/Tests/Windows8SliderTest.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace Digimezzo.WPFControls.Tests.Tests
4 | {
5 | public partial class Windows8SliderTest : Window
6 | {
7 | public Windows8SliderTest()
8 | {
9 | InitializeComponent();
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Base/Constants.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 |
4 | namespace Digimezzo.WPFControls.Base
5 | {
6 | internal static class Constants
7 | {
8 | //Common
9 | public static readonly Duration MouseEnterDuration = new Duration(TimeSpan.FromMilliseconds(250));
10 | public static readonly Duration MouseLeaveDuration = MouseEnterDuration;
11 |
12 | //ToggleSwitch
13 | public static readonly Duration ToggleSwitchDuration = MouseEnterDuration;
14 |
15 | //VirtualizingWrapPanel
16 | public static readonly Duration SmoothScrollingDuration = MouseEnterDuration;
17 |
18 | // UWPSlider
19 | public const int UWPSliderBaseUnit = 8;
20 | public const int UWPSliderCanvasLengthOffset = -2 * UWPSliderBaseUnit;
21 | public const double UWPSliderButtonSize = 2 * UWPSliderBaseUnit;
22 | public static readonly Thickness HorizontalUWPSliderMargin = new Thickness(-UWPSliderBaseUnit, 0, 0, 0);
23 | public static readonly Thickness VerticalUWPSliderMargin = new Thickness(0, 0, 0, -UWPSliderBaseUnit);
24 |
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Base/PropertyChangedBase.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 |
3 | namespace Digimezzo.WPFControls.Base
4 | {
5 | public class PropertyChangedBase : INotifyPropertyChanged
6 | {
7 | public event PropertyChangedEventHandler PropertyChanged;
8 |
9 | protected virtual void OnPropertyChanged(string propertyName)
10 | {
11 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Base/SliderBase.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Windows;
4 | using System.Windows.Controls;
5 | using System.Windows.Input;
6 | using System.Windows.Media;
7 | using System.Windows.Shapes;
8 |
9 | namespace Digimezzo.WPFControls.Base
10 | {
11 | public abstract class SliderBase : Control
12 | {
13 | protected Canvas sliderCanvas;
14 | protected Rectangle sliderTrack;
15 | protected Rectangle sliderBar;
16 | protected Button sliderButton;
17 | protected bool isCalculating;
18 | protected bool isDragging;
19 |
20 | public bool ChangeValueWhileDragging
21 | {
22 | get { return Convert.ToBoolean(GetValue(ChangeValueWhileDraggingProperty)); }
23 | set { SetValue(ChangeValueWhileDraggingProperty, value); }
24 | }
25 |
26 | public static readonly DependencyProperty ChangeValueWhileDraggingProperty =
27 | DependencyProperty.Register(nameof(ChangeValueWhileDragging), typeof(bool), typeof(SliderBase), new PropertyMetadata(false));
28 |
29 | public double Minimum
30 | {
31 | get { return Convert.ToDouble(GetValue(MinimumProperty)); }
32 | set { SetValue(MinimumProperty, value); }
33 | }
34 |
35 | public static readonly DependencyProperty MinimumProperty =
36 | DependencyProperty.Register(nameof(Minimum), typeof(double), typeof(SliderBase), new PropertyMetadata(0.0, IsMinMaxChangedCallback));
37 |
38 | public double Maximum
39 | {
40 | get { return Convert.ToDouble(GetValue(MaximumProperty)); }
41 | set { SetValue(MaximumProperty, value); }
42 | }
43 |
44 | public static readonly DependencyProperty MaximumProperty =
45 | DependencyProperty.Register(nameof(Maximum), typeof(double), typeof(SliderBase), new PropertyMetadata(100.0, IsMinMaxChangedCallback));
46 |
47 | public double Value
48 | {
49 | get { return Convert.ToDouble(GetValue(ValueProperty)); }
50 | set { SetValue(ValueProperty, value); }
51 | }
52 |
53 | public static readonly DependencyProperty ValueProperty =
54 | DependencyProperty.Register(nameof(Value), typeof(double), typeof(SliderBase), new PropertyMetadata(0.0, IsValueChangedCallback));
55 |
56 | [EditorBrowsable(EditorBrowsableState.Never)]
57 | public double Position
58 | {
59 | get { return Convert.ToDouble(GetValue(PositionProperty)); }
60 | set { SetValue(PositionProperty, value); }
61 | }
62 |
63 | public static readonly DependencyProperty PositionProperty =
64 | DependencyProperty.Register(nameof(Position), typeof(double), typeof(SliderBase), new PropertyMetadata(0.0));
65 |
66 | public Brush TrackBackground
67 | {
68 | get { return (Brush)GetValue(TrackBackgroundProperty); }
69 | set { SetValue(TrackBackgroundProperty, value); }
70 | }
71 |
72 | public static readonly DependencyProperty TrackBackgroundProperty =
73 | DependencyProperty.Register(nameof(TrackBackground), typeof(Brush), typeof(SliderBase), new PropertyMetadata(null));
74 |
75 | public Brush BarBackground
76 | {
77 | get { return (Brush)GetValue(BarBackgroundProperty); }
78 | set { SetValue(BarBackgroundProperty, value); }
79 | }
80 |
81 | public static readonly DependencyProperty BarBackgroundProperty =
82 | DependencyProperty.Register(nameof(BarBackground), typeof(Brush), typeof(SliderBase), new PropertyMetadata(null));
83 |
84 | public Brush ButtonBackground
85 | {
86 | get { return (Brush)GetValue(ButtonBackgroundProperty); }
87 | set { SetValue(ButtonBackgroundProperty, value); }
88 | }
89 |
90 | public static readonly DependencyProperty ButtonBackgroundProperty =
91 | DependencyProperty.Register(nameof(ButtonBackground), typeof(Brush), typeof(SliderBase), new PropertyMetadata(null));
92 |
93 | public event EventHandler ValueChanged = delegate { };
94 |
95 | protected void OnValueChanged()
96 | {
97 | this.ValueChanged(this, null);
98 | }
99 |
100 | public override void OnApplyTemplate()
101 | {
102 | base.OnApplyTemplate();
103 |
104 | this.sliderCanvas = (Canvas)GetTemplateChild("PART_Canvas");
105 | this.sliderTrack = (Rectangle)GetTemplateChild("PART_Track");
106 | this.sliderBar = (Rectangle)GetTemplateChild("PART_Bar");
107 | this.sliderButton = (Button)GetTemplateChild("PART_Button");
108 |
109 | this.sliderCanvas.SizeChanged += SizeChangedHandler;
110 | this.sliderCanvas.Loaded += LoadedHandler;
111 |
112 | if (this.sliderButton != null)
113 | {
114 | this.sliderButton.PreviewMouseDown += SliderButton_PreviewMouseDown;
115 | this.sliderButton.PreviewMouseUp += SliderButton_PreviewMouseUp;
116 | this.sliderButton.PreviewMouseMove += SliderButton_PreviewMouseMove;
117 | }
118 |
119 | if (this.sliderCanvas != null)
120 | {
121 | this.sliderCanvas.PreviewMouseUp += SliderCanvas_PreviewMouseUp;
122 | }
123 | }
124 |
125 | protected abstract void UpdatePosition();
126 | protected abstract void CalculatePosition();
127 | protected abstract void CalculateValue();
128 |
129 | private void LoadedHandler(object sender, RoutedEventArgs e)
130 | {
131 | this.CalculatePosition();
132 | }
133 |
134 | private void SizeChangedHandler(object sender, SizeChangedEventArgs e)
135 | {
136 | this.CalculatePosition();
137 | }
138 |
139 | private void SliderButton_PreviewMouseDown(object sender, MouseButtonEventArgs e)
140 | {
141 | this.isDragging = true;
142 | }
143 |
144 | private void SliderButton_PreviewMouseUp(object sender, MouseButtonEventArgs e)
145 | {
146 | this.isDragging = false;
147 | this.CalculateValue();
148 | }
149 |
150 | private void SliderButton_PreviewMouseMove(object sender, MouseEventArgs e)
151 | {
152 | if (this.isDragging)
153 | {
154 | this.UpdatePosition();
155 |
156 | if (this.ChangeValueWhileDragging)
157 | {
158 | this.CalculateValue();
159 | }
160 | }
161 | }
162 |
163 | private void SliderCanvas_PreviewMouseUp(object sender, MouseButtonEventArgs e)
164 | {
165 | if (!this.isDragging)
166 | {
167 | this.UpdatePosition();
168 | this.CalculateValue();
169 | }
170 | }
171 |
172 | private static void IsMinMaxChangedCallback(DependencyObject sender, DependencyPropertyChangedEventArgs e)
173 | {
174 | SliderBase slider = sender as SliderBase;
175 | slider.CalculatePosition();
176 | }
177 |
178 | private static void IsValueChangedCallback(DependencyObject sender, DependencyPropertyChangedEventArgs e)
179 | {
180 | SliderBase slider = sender as SliderBase;
181 | slider.CalculatePosition();
182 | slider.OnValueChanged();
183 | }
184 | }
185 | }
186 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/BorderlessWindows10Window.cs:
--------------------------------------------------------------------------------
1 | using Digimezzo.WPFControls.Base;
2 | using System.Windows;
3 | using System.Windows.Media;
4 |
5 | namespace Digimezzo.WPFControls
6 | {
7 | public abstract class BorderlessWindows10Window : BorderlessWindowBase
8 | {
9 | public bool ApplyDefaultButtonColors
10 | {
11 | get { return (bool)GetValue(ApplyDefaultButtonColorsProperty); }
12 | set { SetValue(ApplyDefaultButtonColorsProperty, value); }
13 | }
14 |
15 | public static readonly DependencyProperty ApplyDefaultButtonColorsProperty =
16 | DependencyProperty.Register(nameof(ApplyDefaultButtonColors), typeof(bool), typeof(BorderlessWindowBase), new PropertyMetadata(true));
17 |
18 | static BorderlessWindows10Window()
19 | {
20 | DefaultStyleKeyProperty.OverrideMetadata(typeof(BorderlessWindows10Window), new FrameworkPropertyMetadata(typeof(BorderlessWindows10Window)));
21 | }
22 |
23 | public override void OnApplyTemplate()
24 | {
25 | base.OnApplyTemplate();
26 |
27 | if (this.ApplyDefaultButtonColors)
28 | {
29 | this.TitleBarHeight = 29;
30 | this.MinMaxBackground = Brushes.Transparent;
31 | this.MinMaxHoveredBackground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#E5E5E5"));
32 | this.MinMaxPressedBackground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#CACACB"));
33 | this.MinMaxForeground = Brushes.Black;
34 | this.MinMaxHoveredForeground = Brushes.Black;
35 | this.MinMaxPressedForeground = Brushes.Black;
36 | this.CloseBackground = Brushes.Transparent;
37 | this.CloseHoveredBackground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#E81123"));
38 | this.ClosePressedBackground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#F1707A"));
39 | this.CloseForeground = Brushes.Black;
40 | this.CloseHoveredForeground = Brushes.White;
41 | this.ClosePressedForeground = Brushes.White;
42 | }
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/BorderlessWindows8Window.cs:
--------------------------------------------------------------------------------
1 | using Digimezzo.WPFControls.Base;
2 | using System.Windows;
3 |
4 | namespace Digimezzo.WPFControls
5 | {
6 | public abstract class BorderlessWindows8Window : BorderlessWindowBase
7 | {
8 | static BorderlessWindows8Window()
9 | {
10 | DefaultStyleKeyProperty.OverrideMetadata(typeof(BorderlessWindows8Window), new FrameworkPropertyMetadata(typeof(BorderlessWindows8Window)));
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Converters/AddValueConverter.cs:
--------------------------------------------------------------------------------
1 | using Digimezzo.WPFControls.Extensions;
2 | using System;
3 | using System.Globalization;
4 | using System.Windows.Data;
5 |
6 | namespace Digimezzo.WPFControls.Converters
7 | {
8 | public class AddValueConverter : IValueConverter
9 | {
10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
11 | {
12 |
13 | if (value == null || parameter == null || !parameter.ToString().IsNumeric())
14 | {
15 | return Binding.DoNothing;
16 | }
17 |
18 | return double.Parse(value.ToString()) + double.Parse(parameter.ToString());
19 | }
20 |
21 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
22 | {
23 | return Binding.DoNothing;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Converters/BooleanToCollapsedConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows;
4 | using System.Windows.Data;
5 |
6 | namespace Digimezzo.WPFControls.Converters
7 | {
8 | public class BooleanToCollapsedConverter : IValueConverter
9 | {
10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
11 | {
12 |
13 | bool vis = System.Convert.ToBoolean(value);
14 | return vis ? Visibility.Visible : Visibility.Collapsed;
15 | }
16 |
17 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
18 | {
19 | Visibility vis = (Visibility)value;
20 | return (vis == Visibility.Visible);
21 | }
22 | }
23 |
24 | public class InvertingBooleanToCollapsedConverter : IValueConverter
25 | {
26 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
27 | {
28 |
29 | bool vis = System.Convert.ToBoolean(value);
30 | return vis ? Visibility.Collapsed : Visibility.Visible;
31 | }
32 |
33 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
34 | {
35 | Visibility vis = (Visibility)value;
36 | return (vis == Visibility.Collapsed);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Converters/BooleanToVisibilityConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows;
4 | using System.Windows.Data;
5 |
6 | namespace Digimezzo.WPFControls.Converters
7 | {
8 | public class BooleanToVisibilityConverter : IValueConverter
9 | {
10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
11 | {
12 |
13 | bool vis = System.Convert.ToBoolean(value);
14 | return vis ? Visibility.Visible : Visibility.Hidden;
15 | }
16 |
17 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
18 | {
19 | Visibility vis = (Visibility)value;
20 | return (vis == Visibility.Visible);
21 | }
22 | }
23 |
24 | public class InvertingBooleanToVisibilityConverter : IValueConverter
25 | {
26 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
27 | {
28 |
29 | bool vis = System.Convert.ToBoolean(value);
30 | return vis ? Visibility.Hidden : Visibility.Visible;
31 | }
32 |
33 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
34 | {
35 | Visibility vis = (Visibility)value;
36 | return (vis == Visibility.Hidden);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Converters/ColorToSolidColorBrushConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows.Data;
4 | using System.Windows.Media;
5 |
6 | namespace Digimezzo.WPFControls.Converters
7 | {
8 | [ValueConversion(typeof(Color), typeof(SolidColorBrush))]
9 | public class ColorToSolidColorBrushConverter : IValueConverter
10 | {
11 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
12 | {
13 | if (value == null)
14 | {
15 | return null;
16 | }
17 |
18 | if (!(value is Color))
19 | {
20 | throw new InvalidOperationException("Unsupported type [" + value.GetType().Name + "], ColorToSolidColorBrushConverter.Convert()");
21 | }
22 |
23 | return new SolidColorBrush((Color)value);
24 | }
25 |
26 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
27 | {
28 | throw new NotSupportedException();
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Converters/IntRatioConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows.Data;
4 |
5 | namespace Digimezzo.WPFControls.Converters
6 | {
7 | public class IntRatioConverter : IValueConverter
8 | {
9 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
10 | {
11 | var num = (double) value * System.Convert.ToInt32(parameter);
12 | return ((int) num).ToString();
13 | }
14 |
15 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
16 | {
17 | var num = System.Convert.ToDouble(value);
18 | var para = System.Convert.ToInt32(parameter);
19 | return num / para;
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Converters/InvertingBooleanConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows.Data;
4 |
5 | namespace Digimezzo.WPFControls.Converters
6 | {
7 | public class InvertingBooleanConverter : IValueConverter
8 | {
9 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
10 | {
11 | if (targetType != typeof(bool))
12 | {
13 | throw new InvalidOperationException("The target must be a boolean");
14 | }
15 |
16 | return !bool.Parse(value.ToString());
17 | }
18 |
19 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
20 | {
21 | throw new NotSupportedException();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Converters/NullToCollapsedConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows;
4 | using System.Windows.Data;
5 |
6 | namespace Digimezzo.WPFControls.Converters
7 | {
8 | public class NullToCollapsedConverter : IValueConverter
9 | {
10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
11 | {
12 | if (value == null)
13 | {
14 | return Visibility.Collapsed;
15 | }
16 |
17 | return Visibility.Visible;
18 | }
19 |
20 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
21 | {
22 | return Binding.DoNothing;
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Converters/NullToVisibleConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows;
4 | using System.Windows.Data;
5 |
6 | namespace Digimezzo.WPFControls.Converters
7 | {
8 | public class NullToVisibleConverter : IValueConverter
9 | {
10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
11 | {
12 | if (value == null)
13 | {
14 | return Visibility.Visible;
15 | }
16 |
17 | return Visibility.Collapsed;
18 | }
19 |
20 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
21 | {
22 | return Binding.DoNothing;
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Converters/ResizeModeMinMaxButtonVisibilityConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows;
4 | using System.Windows.Data;
5 |
6 | namespace Digimezzo.WPFControls.Converters
7 | {
8 | ///
9 | /// ResizeModeMinMaxButtonVisibilityConverter is based on code from MahApps.Metro: https://github.com/MahApps/MahApps.Metro
10 | /// Their license is included in the "Licenses" folder.
11 | ///
12 | public class ResizeModeMinMaxButtonVisibilityConverter : IMultiValueConverter
13 | {
14 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
15 | {
16 | if (values != null && values.Length == 2 && parameter is string)
17 | {
18 | bool windowPropValue = System.Convert.ToBoolean(values[0]);
19 | ResizeMode windowResizeMode = (ResizeMode)values[1];
20 | string whichButton = System.Convert.ToString(parameter);
21 |
22 | switch (windowResizeMode)
23 | {
24 | case ResizeMode.NoResize:
25 | return Visibility.Collapsed;
26 | case ResizeMode.CanMinimize:
27 | if (whichButton == "MIN")
28 | {
29 | return (windowPropValue ? Visibility.Visible : Visibility.Collapsed);
30 | }
31 | return Visibility.Collapsed;
32 | case ResizeMode.CanResize:
33 | return (windowPropValue ? Visibility.Visible : Visibility.Collapsed);
34 | case ResizeMode.CanResizeWithGrip:
35 | return (windowPropValue ? Visibility.Visible : Visibility.Collapsed);
36 | default:
37 | return (windowPropValue ? Visibility.Visible : Visibility.Collapsed);
38 | }
39 | }
40 | return Visibility.Visible;
41 | }
42 |
43 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
44 | {
45 | throw new NotImplementedException();
46 | }
47 | }
48 | }
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Converters/SolidColorBrushToColorConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows.Data;
4 | using System.Windows.Media;
5 |
6 | namespace Digimezzo.WPFControls.Converters
7 | {
8 | public class SolidColorBrushToColorConverter : IValueConverter
9 | {
10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
11 | {
12 | if (value == null)
13 | {
14 | return null;
15 | }
16 |
17 | if (!(value is SolidColorBrush))
18 | {
19 | throw new InvalidOperationException("Unsupported type [" + value.GetType().Name + "], SolidColorBrushToColorConverter.Convert()");
20 | }
21 |
22 | return ((SolidColorBrush)value).Color;
23 | }
24 |
25 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
26 | {
27 | throw new NotSupportedException();
28 | }
29 |
30 | }
31 | }
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Converters/StringToLowerConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows.Data;
4 |
5 | namespace Digimezzo.WPFControls.Converters
6 | {
7 | public class StringToLowerConverter : IValueConverter
8 | {
9 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
10 | {
11 | if (value != null)
12 | {
13 | return System.Convert.ToString(value).ToLower();
14 | }
15 | return value;
16 | }
17 |
18 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
19 | {
20 | throw new NotSupportedException();
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Converters/StringToUpperConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows.Data;
4 |
5 | namespace Digimezzo.WPFControls.Converters
6 | {
7 | public class StringToUpperConverter : IValueConverter
8 | {
9 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
10 | {
11 | if (value != null)
12 | {
13 | return System.Convert.ToString(value).ToUpper();
14 | }
15 | return value;
16 | }
17 |
18 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
19 | {
20 | throw new NotSupportedException();
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Effects/FeatheringEffect.cs:
--------------------------------------------------------------------------------
1 | using Digimezzo.WPFControls.Utils;
2 | using System.Windows;
3 | using System.Windows.Media;
4 | using System.Windows.Media.Effects;
5 |
6 | namespace Digimezzo.WPFControls.Effects
7 | {
8 | public class FeatheringEffect : ShaderEffect
9 | {
10 | #region Variables
11 | private static PixelShader shader = new PixelShader()
12 | {
13 | UriSource = UriUtils.MakePackUri("Effects/FeatheringEffect.ps")
14 | };
15 | #endregion
16 |
17 | #region Properties
18 | public Brush InputBackground
19 | {
20 | get => (Brush)GetValue(InputBackgroundProperty);
21 | set => SetValue(InputBackgroundProperty, value);
22 | }
23 |
24 | public double FeatheringRadius
25 | {
26 | get => (double) GetValue(FeatheringRadiusProperty);
27 | set => SetValue(FeatheringRadiusProperty, value);
28 | }
29 |
30 | public double TexWidth
31 | {
32 | get => (double)GetValue(TexWidthProperty);
33 | set => SetValue(TexWidthProperty, value);
34 | }
35 | #endregion
36 |
37 | #region Dependency Properties
38 | public static DependencyProperty InputBackgroundProperty =
39 | RegisterPixelShaderSamplerProperty("InputBackground", typeof(FeatheringEffect), 0);
40 |
41 | public static DependencyProperty FeatheringRadiusProperty = DependencyProperty.Register("FeatheringRadius",
42 | typeof(double), typeof(FeatheringEffect), new UIPropertyMetadata(default(double), PixelShaderConstantCallback(0)));
43 |
44 | public static DependencyProperty TexWidthProperty = DependencyProperty.Register("TexWidth", typeof(double),
45 | typeof(FeatheringEffect), new UIPropertyMetadata(default(double), PixelShaderConstantCallback(1)));
46 | #endregion
47 |
48 | #region Constructor
49 | public FeatheringEffect()
50 | {
51 | PixelShader = shader;
52 | UpdateShaderValue(InputBackgroundProperty);
53 | UpdateShaderValue(FeatheringRadiusProperty);
54 | UpdateShaderValue(TexWidthProperty);
55 | }
56 | #endregion
57 | }
58 | }
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Effects/FeatheringEffect.fx:
--------------------------------------------------------------------------------
1 | //ps_3_0
2 |
3 | sampler2D implicitInputBackground : register(s0);
4 | float implicitfeather : register(c0);
5 | float implicitwidth : register(c1);
6 | float implicitheight : register(c2);
7 |
8 | float4 main(float2 uv : TEXCOORD) : COLOR
9 | {
10 | float4 colorSample = tex2D(implicitInputBackground, uv);
11 | float width = uv[0] * implicitwidth;
12 | float feather = implicitfeather;
13 | if (width < feather)
14 | {
15 | colorSample *= width / feather;
16 | }
17 | if (width > implicitwidth - feather)
18 | {
19 | colorSample *= (implicitwidth - width) / feather;
20 | }
21 |
22 | return colorSample;
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Effects/FeatheringEffect.ps:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/digimezzo/WPFControls/ccab6272ef4a76ce2496da616e52fa04a6fc70d9/Digimezzo.WPFControls/Effects/FeatheringEffect.ps
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Effects/HsvWheelEffect.cs:
--------------------------------------------------------------------------------
1 | using Digimezzo.WPFControls.Utils;
2 | using System.Windows;
3 | using System.Windows.Media;
4 | using System.Windows.Media.Effects;
5 |
6 | namespace Digimezzo.WPFControls.Effects
7 | {
8 | /// ColorPicker is based on code from Gu.Wpf.Geometry owned by JohanLarsson: https://github.com/JohanLarsson/Gu.Wpf.Geometry
9 | /// Their license is included in the "Licenses" folder.
10 |
11 | ///
12 | /// An effect that renders a HSV colour wheel.
13 | ///
14 | public class HsvWheelEffect : ShaderEffect
15 | {
16 | #region Variables
17 | private static readonly PixelShader Shader = new PixelShader()
18 | {
19 | UriSource = UriUtils.MakePackUri("Effects/HsvWheelEffect.ps")
20 | };
21 | #endregion
22 |
23 | #region Dependency Properties
24 | public static readonly DependencyProperty InputProperty = RegisterPixelShaderSamplerProperty(
25 | nameof(Input),
26 | typeof(HsvWheelEffect),
27 | 0);
28 |
29 | public static readonly DependencyProperty InnerRadiusProperty = DependencyProperty.Register(
30 | nameof(InnerRadius),
31 | typeof(double),
32 | typeof(HsvWheelEffect),
33 | new UIPropertyMetadata(0d, PixelShaderConstantCallback(0)));
34 |
35 | public static readonly DependencyProperty InnerSaturationProperty = DependencyProperty.Register(
36 | nameof(InnerSaturation),
37 | typeof(double),
38 | typeof(HsvWheelEffect),
39 | new UIPropertyMetadata(0d, PixelShaderConstantCallback(1)));
40 |
41 | public static readonly DependencyProperty ValueProperty = DependencyProperty.Register(
42 | nameof(Value),
43 | typeof(double),
44 | typeof(HsvWheelEffect),
45 | new UIPropertyMetadata(1d, PixelShaderConstantCallback(2)));
46 |
47 | public static readonly DependencyProperty StartAngleProperty = DependencyProperty.Register(
48 | nameof(StartAngle),
49 | typeof(double),
50 | typeof(HsvWheelEffect),
51 | new UIPropertyMetadata(
52 | 270d,
53 | PixelShaderConstantCallback(3)));
54 | #endregion
55 |
56 | #region Properties
57 | ///
58 | /// There has to be a property of type Brush called "Input". This property contains the input image and it is usually not set directly - it is set automatically when our effect is applied to a control.
59 | ///
60 | public Brush Input
61 | {
62 | get => (Brush)GetValue(InputProperty);
63 | set => SetValue(InputProperty, value);
64 | }
65 |
66 | public double InnerRadius
67 | {
68 | get => (double)GetValue(InnerRadiusProperty);
69 | set => SetValue(InnerRadiusProperty, value);
70 | }
71 |
72 | public double InnerSaturation
73 | {
74 | get => (double)GetValue(InnerSaturationProperty);
75 | set => SetValue(InnerSaturationProperty, value);
76 | }
77 |
78 | public double Value
79 | {
80 | get => (double)GetValue(ValueProperty);
81 | set => SetValue(ValueProperty, value);
82 | }
83 |
84 | public double StartAngle
85 | {
86 | get => (double)GetValue(StartAngleProperty);
87 | set => SetValue(StartAngleProperty, value);
88 | }
89 | #endregion
90 |
91 | #region Constructor
92 | public HsvWheelEffect()
93 | {
94 | PixelShader = Shader;
95 | UpdateShaderValue(InputProperty);
96 | UpdateShaderValue(InnerRadiusProperty);
97 | UpdateShaderValue(InnerSaturationProperty);
98 | UpdateShaderValue(ValueProperty);
99 | UpdateShaderValue(StartAngleProperty);
100 | }
101 | #endregion
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Effects/HsvWheelEffect.fx:
--------------------------------------------------------------------------------
1 | /// ColorPicker is based on code from Gu.Wpf.Geometry owned by JohanLarsson: https://github.com/JohanLarsson/Gu.Wpf.Geometry
2 | /// Their license is included in the "Licenses" folder.
3 |
4 | static float PI = 3.14159274f;
5 | static float PI2 = 6.28318548f;
6 | static float2 cp = float2(0.5, 0.5);
7 |
8 | /// The inner radius.
9 | /// 0
10 | /// 1
11 | /// 0
12 | float InnerRadius : register(C0);
13 |
14 | /// The inner saturation.
15 | /// 0
16 | /// 1
17 | /// 0
18 | float InnerSaturation : register(C1);
19 |
20 | /// The value.
21 | /// 0
22 | /// 1
23 | /// 1
24 | float Value : register(C2);
25 |
26 | /// The starting angle of the gradient, clockwise from X-axis
27 | /// -360
28 | /// 360
29 | /// 90
30 | float StartAngle : register(C3);
31 |
32 | float4 lerp_rgba(float4 x, float4 y, float s)
33 | {
34 | float a = lerp(x.a, y.a, s);
35 | float3 rgb = lerp(x.rgb, y.rgb, s) * a;
36 | return float4(rgb.r, rgb.g, rgb.b, a);
37 | }
38 |
39 | float interpolate(float min, float max, float value)
40 | {
41 | if (min == max)
42 | {
43 | return 0.5;
44 | }
45 |
46 | if (min < max)
47 | {
48 | return clamp((value - min) / (max - min), 0, 1);
49 | }
50 |
51 | return clamp((value - max) / (min - max), 0, 1);
52 | }
53 |
54 | float clamp_angle_positive(float a)
55 | {
56 | if (a < 0)
57 | {
58 | return a + PI2;
59 | }
60 |
61 | return a;
62 | }
63 |
64 | float clamp_angle_negative(float a)
65 | {
66 | if (a > 0)
67 | {
68 | return a - PI2;
69 | }
70 |
71 | return a;
72 | }
73 |
74 | float angle_from_start(float2 uv, float2 center_point, float start_angle, float central_angle)
75 | {
76 | float2 v = uv - center_point;
77 | return central_angle > 0
78 | ? clamp_angle_positive(clamp_angle_positive(atan2(v.x, -v.y)) - clamp_angle_positive(start_angle))
79 | : abs(clamp_angle_negative(clamp_angle_negative(atan2(v.x, -v.y)) - clamp_angle_negative(start_angle)));
80 | }
81 |
82 | float3 HUEtoRGB(in float H)
83 | {
84 | float R = abs(H * 6 - 3) - 1;
85 | float G = 2 - abs(H * 6 - 2);
86 | float B = 2 - abs(H * 6 - 4);
87 | return saturate(float3(R, G, B));
88 | }
89 |
90 | // http://www.chilliant.com/rgb2hsv.html
91 | float3 HSVtoRGB(in float3 HSV)
92 | {
93 | float3 RGB = HUEtoRGB(HSV.x);
94 | return ((RGB - 1) * HSV.y + 1) * HSV.z;
95 | }
96 |
97 | float4 main(float2 uv : TEXCOORD) : COLOR
98 | {
99 | float2 rv = uv - cp;
100 | float r = length(rv);
101 | float ir = InnerRadius / 2;
102 | if (r >= ir && r <= 0.5)
103 | {
104 | float sa = radians(StartAngle);
105 | float h = interpolate(
106 | 0,
107 | PI2,
108 | angle_from_start(uv, cp, sa, PI2));
109 | float s = lerp(InnerSaturation, 1, interpolate(ir, 0.5, r));
110 | float v = Value;
111 | return float4(HSVtoRGB(float3(h, s, v)), 1);
112 | }
113 |
114 | return float4(0, 0, 0, 0);
115 | }
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Effects/HsvWheelEffect.ps:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/digimezzo/WPFControls/ccab6272ef4a76ce2496da616e52fa04a6fc70d9/Digimezzo.WPFControls/Effects/HsvWheelEffect.ps
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Enums/SlideDirection.cs:
--------------------------------------------------------------------------------
1 | namespace Digimezzo.WPFControls.Enums
2 | {
3 | public enum SlideDirection
4 | {
5 | LeftToRight = 1,
6 | RightToLeft = 2,
7 | UpToDown = 3,
8 | DownToUp = 4
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Enums/WrapPanelAlignment.cs:
--------------------------------------------------------------------------------
1 | namespace Digimezzo.WPFControls.Enums
2 | {
3 | public enum WrapPanelAlignment
4 | {
5 | Left,
6 | Right,
7 | Center
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Extensions/StringExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace Digimezzo.WPFControls.Extensions
2 | {
3 | public static class StringExtensions
4 | {
5 | public static bool IsNumeric(this string str)
6 | {
7 | float output;
8 | return float.TryParse(str, out output);
9 | }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/LabelToLower.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls;
3 |
4 | namespace Digimezzo.WPFControls
5 | {
6 | public class LabelToLower : Label
7 | {
8 | static LabelToLower()
9 | {
10 | DefaultStyleKeyProperty.OverrideMetadata(typeof(LabelToLower), new FrameworkPropertyMetadata(typeof(LabelToLower)));
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/LabelToUpper.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls;
3 |
4 | namespace Digimezzo.WPFControls
5 | {
6 | public class LabelToUpper : Label
7 | {
8 | static LabelToUpper()
9 | {
10 | DefaultStyleKeyProperty.OverrideMetadata(typeof(LabelToUpper), new FrameworkPropertyMetadata(typeof(LabelToUpper)));
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Licenses/Gu.Wpf.Geometry.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Johan Larsson
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 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Licenses/MahApps.Metro.txt:
--------------------------------------------------------------------------------
1 | Microsoft Public License (Ms-PL)
2 |
3 | This license governs use of the accompanying software. If you use the software, you
4 | accept this license. If you do not accept the license, do not use the software.
5 |
6 | 1. Definitions
7 | The terms "reproduce," "reproduction," "derivative works," and "distribution" have the
8 | same meaning here as under U.S. copyright law.
9 | A "contribution" is the original software, or any additions or changes to the software.
10 | A "contributor" is any person that distributes its contribution under this license.
11 | "Licensed patents" are a contributor's patent claims that read directly on its contribution.
12 |
13 | 2. Grant of Rights
14 | (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
15 | (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
16 |
17 | 3. Conditions and Limitations
18 | (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
19 | (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
20 | (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
21 | (D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
22 | (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Licenses/PropertyTools.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 PropertyTools contributors
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a
6 | copy of this software and associated documentation files (the
7 | "Software"), to deal in the Software without restriction, including
8 | without limitation the rights to use, copy, modify, merge, publish,
9 | distribute, sublicense, and/or sell copies of the Software, and to
10 | permit persons to whom the Software is furnished to do so, subject to
11 | the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included
14 | in all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/MaterialButtons.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls;
3 | using System.Windows.Media;
4 |
5 | namespace Digimezzo.WPFControls
6 | {
7 | public class MaterialButtonBase : Button
8 | {
9 | public Brush Accent
10 | {
11 | get { return (Brush)GetValue(AccentProperty); }
12 | set { SetValue(AccentProperty, value); }
13 | }
14 |
15 | public static readonly DependencyProperty AccentProperty =
16 | DependencyProperty.Register(nameof(Accent), typeof(Brush), typeof(MaterialButtonBase), new PropertyMetadata(Brushes.Red));
17 |
18 | static MaterialButtonBase()
19 | {
20 | DefaultStyleKeyProperty.OverrideMetadata(typeof(MaterialButtonBase), new FrameworkPropertyMetadata(typeof(MaterialButtonBase)));
21 | }
22 | }
23 |
24 | public class MaterialRaisedButton : MaterialButtonBase
25 | {
26 | static MaterialRaisedButton()
27 | {
28 | DefaultStyleKeyProperty.OverrideMetadata(typeof(MaterialRaisedButton), new FrameworkPropertyMetadata(typeof(MaterialRaisedButton)));
29 | }
30 | }
31 |
32 | public class MaterialFlatButton : MaterialButtonBase
33 | {
34 | static MaterialFlatButton()
35 | {
36 | DefaultStyleKeyProperty.OverrideMetadata(typeof(MaterialFlatButton), new FrameworkPropertyMetadata(typeof(MaterialFlatButton)));
37 | }
38 | }
39 |
40 | public class MaterialFloatingActionButton : MaterialButtonBase
41 | {
42 | static MaterialFloatingActionButton()
43 | {
44 | DefaultStyleKeyProperty.OverrideMetadata(typeof(MaterialFloatingActionButton), new FrameworkPropertyMetadata(typeof(MaterialFloatingActionButton)));
45 | }
46 | }
47 |
48 | public class MaterialMiniFloatingActionButton : MaterialButtonBase
49 | {
50 | static MaterialMiniFloatingActionButton()
51 | {
52 | DefaultStyleKeyProperty.OverrideMetadata(typeof(MaterialMiniFloatingActionButton), new FrameworkPropertyMetadata(typeof(MaterialMiniFloatingActionButton)));
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/MaterialToggleSwitch.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls;
3 | using System.Windows.Input;
4 | using System.Windows.Media;
5 |
6 | namespace Digimezzo.WPFControls
7 | {
8 | public class MaterialToggleSwitch : CheckBox
9 | {
10 | private Ripple ripple;
11 |
12 | public Brush Accent
13 | {
14 | get { return (Brush)GetValue(AccentProperty); }
15 | set { SetValue(AccentProperty, value); }
16 | }
17 |
18 | public static readonly DependencyProperty AccentProperty =
19 | DependencyProperty.Register(nameof(Accent), typeof(Brush), typeof(MaterialToggleSwitch), new PropertyMetadata(new SolidColorBrush(Colors.Blue)));
20 |
21 | static MaterialToggleSwitch()
22 | {
23 | DefaultStyleKeyProperty.OverrideMetadata(typeof(MaterialToggleSwitch), new FrameworkPropertyMetadata(typeof(MaterialToggleSwitch)));
24 | }
25 |
26 | public override void OnApplyTemplate()
27 | {
28 | base.OnApplyTemplate();
29 |
30 | this.ripple = (Ripple)GetTemplateChild("PART_Ripple");
31 |
32 | if(this.Background == null)
33 | {
34 | this.Background = new SolidColorBrush(Colors.Black);
35 | }
36 | }
37 |
38 | protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e)
39 | {
40 | base.OnPreviewMouseLeftButtonDown(e);
41 | this.ripple.DoRippple();
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/MultiSelectListBox.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls;
3 | using System.Windows.Input;
4 |
5 | namespace Digimezzo.WPFControls
6 | {
7 | ///
8 | /// The default WPF ListBox deselects items on MouseDown instead of MouseUp, which causes deselection
9 | /// of selected items when starting a Drag operation. This ListBox enables Windows Explorer like drag/drop
10 | /// behaviour by deferring deselection to MouseUp. This code is based on code from David Schmitt in this
11 | /// stackoverflow article http://stackoverflow.com/questions/1553622/wpf-drag-drop-from-listbox-with-selectionmode-multiple
12 | ///
13 | ///
14 | public class MultiSelectListBox : ListBox
15 | {
16 | protected override DependencyObject GetContainerForItemOverride()
17 | {
18 | return new MultiSelectListBoxItem();
19 | }
20 |
21 | public class MultiSelectListBoxItem : ListBoxItem
22 | {
23 | private bool deferSelection = false;
24 |
25 | protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
26 | {
27 |
28 | if ((e.ClickCount == 1 && IsSelected))
29 | {
30 | // The user may start a drag by clicking on the selected items
31 | // Delay destroying the selection to the Up event
32 | this.deferSelection = true;
33 | }
34 | else
35 | {
36 | base.OnMouseLeftButtonDown(e);
37 | }
38 | }
39 |
40 | protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
41 | {
42 | if (this.deferSelection)
43 | {
44 | try
45 | {
46 | base.OnMouseLeftButtonDown(e);
47 | }
48 | finally
49 | {
50 | this.deferSelection = false;
51 | }
52 |
53 | base.OnMouseLeftButtonUp(e);
54 | }
55 | }
56 |
57 | protected override void OnMouseLeave(MouseEventArgs e)
58 | {
59 | // Abort deferred Down
60 | this.deferSelection = false;
61 | base.OnMouseLeave(e);
62 | }
63 | }
64 | }
65 | }
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Native/AppBar/Enums.cs:
--------------------------------------------------------------------------------
1 | namespace Digimezzo.WPFControls.Native
2 | {
3 | internal enum ABEdge
4 | {
5 | ABE_LEFT = 0,
6 | ABE_TOP = 1,
7 | ABE_RIGHT = 2,
8 | ABE_BOTTOM = 3
9 | }
10 |
11 | internal enum ABMsg
12 | {
13 | ABM_NEW = 0,
14 | ABM_REMOVE = 1,
15 | ABM_QUERYPOS = 2,
16 | ABM_SETPOS = 3,
17 | ABM_GETSTATE = 4,
18 | ABM_GETTASKBARPOS = 5,
19 | ABM_ACTIVATE = 6,
20 | ABM_GETAUTOHIDEBAR = 7,
21 | ABM_SETAUTOHIDEBAR = 8,
22 | ABM_WINDOWPOSCHANGED = 9,
23 | ABM_SETSTATE = 10
24 | }
25 | }
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Native/AppBar/NativeMethods.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace Digimezzo.WPFControls.Native
4 | {
5 | public static partial class NativeMethods
6 | {
7 | [DllImport("shell32.dll")]
8 | internal static extern uint SHAppBarMessage(int dwMessage, ref APPBARDATA pData);
9 | }
10 | }
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Native/AppBar/Structs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace Digimezzo.WPFControls.Native
5 | {
6 | [StructLayout(LayoutKind.Sequential)]
7 | internal struct APPBARDATA
8 | {
9 | public int cbSize;
10 | public IntPtr hWnd;
11 | public int uCallbackMessage;
12 | public int uEdge;
13 | public RECT rc;
14 | public bool lParam;
15 | }
16 |
17 | [StructLayout(LayoutKind.Sequential)]
18 | internal struct MINMAXINFO
19 | {
20 | public POINT ptReserved;
21 | public POINT ptMaxSize;
22 | public POINT ptMaxPosition;
23 | public POINT ptMinTrackSize;
24 | public POINT ptMaxTrackSize;
25 | }
26 |
27 | [StructLayout(LayoutKind.Sequential)]
28 | internal struct POINT
29 | {
30 | public int x;
31 | public int y;
32 |
33 | public POINT(int x, int y)
34 | {
35 | this.x = x;
36 | this.y = y;
37 | }
38 | }
39 | }
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Native/Constants.cs:
--------------------------------------------------------------------------------
1 | namespace Digimezzo.WPFControls.Native
2 | {
3 | public static partial class Constants
4 | {
5 | public const int WM_NCLBUTTONDOWN = 0xa1;
6 | public const int HT_CAPTION = 0x2;
7 | public const uint SWP_SHOWWINDOW = 0x40;
8 | public const int HWND_NOTOPMOST = -2;
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Native/Monitor/Constants.cs:
--------------------------------------------------------------------------------
1 | namespace Digimezzo.WPFControls.Native
2 | {
3 | public static partial class Constants
4 | {
5 | public const uint MONITOR_DEFAULTTONEAREST = 0x2;
6 | }
7 | }
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Native/Monitor/NativeMethods.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace Digimezzo.WPFControls.Native
5 | {
6 | public static partial class NativeMethods
7 | {
8 | [DllImport("user32.dll", EntryPoint = "GetMonitorInfoW", ExactSpelling = true, CharSet = CharSet.Unicode)]
9 | [return: MarshalAs(UnmanagedType.Bool)]
10 | internal static extern bool GetMonitorInfo(IntPtr hMonitor, [Out] MONITORINFO lpmi);
11 |
12 | [DllImport("user32.dll")]
13 | internal static extern IntPtr MonitorFromWindow(IntPtr handle, uint flags);
14 | }
15 | }
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Native/Monitor/Structs.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace Digimezzo.WPFControls.Native
4 | {
5 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
6 | public class MONITORINFO
7 | {
8 | public int cbSize = Marshal.SizeOf(typeof(MONITORINFO));
9 | public RECT rcMonitor = new RECT();
10 | public RECT rcWork = new RECT();
11 | public int dwFlags = 0;
12 | }
13 |
14 | [StructLayout(LayoutKind.Sequential, Pack = 0)]
15 | public struct RECT
16 | {
17 | public int left;
18 | public int top;
19 | public int right;
20 | public int bottom;
21 | }
22 | }
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Native/NativeMethods.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using System.Security;
4 |
5 | namespace Digimezzo.WPFControls.Native
6 | {
7 | [SuppressUnmanagedCodeSecurity]
8 | public static partial class NativeMethods
9 | {
10 | [DllImport("user32.dll")]
11 | public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
12 |
13 | [DllImport("user32.dll")]
14 | [return: MarshalAs(UnmanagedType.Bool)]
15 | internal static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/PageIndicator.cs:
--------------------------------------------------------------------------------
1 | using Digimezzo.WPFControls.Base;
2 | using System;
3 | using System.Collections.ObjectModel;
4 | using System.ComponentModel;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Media;
8 |
9 | namespace Digimezzo.WPFControls
10 | {
11 | public class PageIndicatorItem : PropertyChangedBase
12 | {
13 | private bool isActive;
14 |
15 | public bool IsActive
16 | {
17 | get
18 | {
19 | return isActive;
20 | }
21 | set
22 | {
23 | this.isActive = value;
24 | OnPropertyChanged(nameof(this.IsActive));
25 | }
26 | }
27 | }
28 |
29 | public class PageIndicator : Control
30 | {
31 | public double ItemSize
32 | {
33 | get { return (double)GetValue(ItemSizeProperty); }
34 | set { SetValue(ItemSizeProperty, value); }
35 | }
36 |
37 | public static readonly DependencyProperty ItemSizeProperty =
38 | DependencyProperty.Register(nameof(ItemSize), typeof(double), typeof(PageIndicator), new PropertyMetadata(10.0));
39 |
40 | public double ItemSpacing
41 | {
42 | get { return (double)GetValue(ItemSpacingProperty); }
43 | set { SetValue(ItemSpacingProperty, value); }
44 | }
45 |
46 | public static readonly DependencyProperty ItemSpacingProperty =
47 | DependencyProperty.Register(nameof(ItemSpacing), typeof(double), typeof(PageIndicator), new PropertyMetadata(4.0));
48 |
49 | [Browsable(false)]
50 | public Thickness ItemMargin
51 | {
52 | get { return (Thickness)GetValue(ItemMarginProperty); }
53 | set { SetValue(ItemMarginProperty, value); }
54 | }
55 |
56 | public static readonly DependencyProperty ItemMarginProperty =
57 | DependencyProperty.Register(nameof(ItemMargin), typeof(Thickness), typeof(PageIndicator), new PropertyMetadata(new Thickness(2, 0, 2, 0)));
58 |
59 | public Brush ItemFill
60 | {
61 | get { return (Brush)GetValue(ItemFillProperty); }
62 | set { SetValue(ItemFillProperty, value); }
63 | }
64 |
65 | public static readonly DependencyProperty ItemFillProperty =
66 | DependencyProperty.Register(nameof(ItemFill), typeof(Brush), typeof(PageIndicator), new PropertyMetadata(Brushes.Gray));
67 |
68 | public Brush SelectedItemFill
69 | {
70 | get { return (Brush)GetValue(SelectedItemFillProperty); }
71 | set { SetValue(SelectedItemFillProperty, value); }
72 | }
73 |
74 | public static readonly DependencyProperty SelectedItemFillProperty =
75 | DependencyProperty.Register(nameof(SelectedItemFill), typeof(Brush), typeof(PageIndicator), new PropertyMetadata(Brushes.Red));
76 |
77 | public int NumberOfItems
78 | {
79 | get { return (int)GetValue(NumberOfElementsProperty); }
80 | set { SetValue(NumberOfElementsProperty, value); }
81 | }
82 |
83 | public static readonly DependencyProperty NumberOfElementsProperty =
84 | DependencyProperty.Register(nameof(NumberOfItems), typeof(int), typeof(PageIndicator), new PropertyMetadata(3));
85 |
86 | public int ActiveItem
87 | {
88 | get { return (int)GetValue(ActiveItemProperty); }
89 | set { SetValue(ActiveItemProperty, value); }
90 | }
91 |
92 | public static readonly DependencyProperty ActiveItemProperty =
93 | DependencyProperty.Register(nameof(ActiveItem), typeof(int), typeof(PageIndicator), new PropertyMetadata(0, new PropertyChangedCallback(OnActiveItemPropertyChanged)));
94 |
95 | private static void OnActiveItemPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
96 | {
97 | PageIndicator indicator = d as PageIndicator;
98 |
99 | if (indicator != null)
100 | {
101 | indicator.SetActiveItem();
102 | }
103 | }
104 |
105 | static PageIndicator()
106 | {
107 | DefaultStyleKeyProperty.OverrideMetadata(typeof(PageIndicator), new FrameworkPropertyMetadata(typeof(PageIndicator)));
108 | }
109 |
110 | public ObservableCollection Items { get; set; }
111 |
112 | protected override void OnInitialized(EventArgs e)
113 | {
114 | base.OnInitialized(e);
115 |
116 | this.ItemMargin = new Thickness(this.ItemSpacing / 2, 0, this.ItemSpacing / 2, 0);
117 |
118 | this.Items = new ObservableCollection();
119 |
120 | for (int i = 0; i < this.NumberOfItems; i++)
121 | {
122 | this.Items.Add(new PageIndicatorItem());
123 |
124 | if (i == 0)
125 | {
126 | this.Items[0].IsActive = true;
127 | }
128 | }
129 | }
130 |
131 | public void SetActiveItem()
132 | {
133 | if (this.Items != null && this.Items.Count > 0 && this.ActiveItem >= 0 && this.ActiveItem < this.Items.Count)
134 | {
135 | foreach (PageIndicatorItem item in this.Items)
136 | {
137 | item.IsActive = false;
138 | }
139 |
140 | this.Items[this.ActiveItem].IsActive = true;
141 | }
142 | }
143 | }
144 | }
145 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("Digimezzo.WPFControls")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | //[assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("Digimezzo.WPFControls")]
15 | //[assembly: AssemblyCopyright("Copyright © 2016")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | //[assembly: AssemblyVersion("1.0.0.0")]
55 | //[assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/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 Digimezzo.WPFControls.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("Digimezzo.WPFControls.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 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/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 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/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 Digimezzo.WPFControls.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Ripple.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using System.Windows.Controls;
4 | using System.Windows.Input;
5 | using System.Windows.Media;
6 | using System.Windows.Media.Animation;
7 | using System.Windows.Shapes;
8 |
9 | namespace Digimezzo.WPFControls
10 | {
11 | public class Ripple : ContentControl
12 | {
13 | Ellipse ellipse;
14 |
15 | public Brush RippleBackground
16 | {
17 | get { return (Brush)GetValue(RippleBackgroundProperty); }
18 | set { SetValue(RippleBackgroundProperty, value); }
19 | }
20 |
21 | public static readonly DependencyProperty RippleBackgroundProperty =
22 | DependencyProperty.Register(nameof(RippleBackground), typeof(Brush), typeof(Ripple), new PropertyMetadata(Brushes.White));
23 |
24 | public int DurationMilliseconds
25 | {
26 | get { return (int)GetValue(DurationMillisecondsProperty); }
27 | set { SetValue(DurationMillisecondsProperty, value); }
28 | }
29 |
30 | public static readonly DependencyProperty DurationMillisecondsProperty =
31 | DependencyProperty.Register(nameof(DurationMilliseconds), typeof(int), typeof(Ripple), new PropertyMetadata(500));
32 |
33 | public bool StartAtPointer
34 | {
35 | get { return (bool)GetValue(StartAtPointerProperty); }
36 | set { SetValue(StartAtPointerProperty, value); }
37 | }
38 |
39 | public static readonly DependencyProperty StartAtPointerProperty =
40 | DependencyProperty.Register(nameof(StartAtPointer), typeof(bool), typeof(Ripple), new PropertyMetadata(true));
41 |
42 | public double Scale
43 | {
44 | get { return (double)GetValue(ScaleProperty); }
45 | set { SetValue(ScaleProperty, value); }
46 | }
47 |
48 | public static readonly DependencyProperty ScaleProperty =
49 | DependencyProperty.Register(nameof(Scale), typeof(double), typeof(Ripple), new PropertyMetadata(2.0));
50 |
51 | public bool DoRippleOnMouseClick
52 | {
53 | get { return (bool)GetValue(DoRippleOnMouseClickProperty); }
54 | set { SetValue(DoRippleOnMouseClickProperty, value); }
55 | }
56 |
57 | public static readonly DependencyProperty DoRippleOnMouseClickProperty =
58 | DependencyProperty.Register(nameof(DoRippleOnMouseClick), typeof(bool), typeof(Ripple), new PropertyMetadata(true));
59 |
60 | static Ripple()
61 | {
62 | DefaultStyleKeyProperty.OverrideMetadata(typeof(Ripple), new FrameworkPropertyMetadata(typeof(Ripple)));
63 | }
64 |
65 | public override void OnApplyTemplate()
66 | {
67 | base.OnApplyTemplate();
68 |
69 | ellipse = GetTemplateChild("PART_ellipse") as Ellipse;
70 | this.HorizontalAlignment = HorizontalAlignment.Stretch;
71 | this.VerticalAlignment = VerticalAlignment.Stretch;
72 | }
73 |
74 | public void DoRippple()
75 | {
76 | this.MaxWidth = this.ActualWidth; // Make sure the Width cannot expand due to ellipse expand
77 | this.MaxHeight = this.ActualHeight; // Make sure the Height cannot expand due to ellipse expand
78 |
79 | double targetWidth = Math.Max(this.ActualWidth, this.ActualHeight) * this.Scale;
80 |
81 | Point mousePosition = Mouse.GetPosition(this);
82 |
83 | Thickness startMargin = new Thickness(this.ActualWidth / 2, this.ActualHeight / 2, 0, 0);
84 |
85 | if (this.StartAtPointer)
86 | {
87 | startMargin = new Thickness(mousePosition.X, mousePosition.Y, 0, 0);
88 | }
89 |
90 | int durationOffsetMilliseconds = this.DurationMilliseconds / 4;
91 | var duration = new TimeSpan(0, 0, 0, 0, this.DurationMilliseconds);
92 | var afterDuration = new TimeSpan(0, 0, 0, 0, this.DurationMilliseconds + durationOffsetMilliseconds);
93 |
94 | // Set initial ellipse Margin to mouse position
95 | this.ellipse.Margin = startMargin;
96 |
97 | // Animate ellipse Width
98 | var widthAnimation = new DoubleAnimation(0, targetWidth, duration);
99 |
100 | // Animate ellipse Margin
101 | var targetMargin = new Thickness((this.ActualWidth - targetWidth) / 2);
102 |
103 | if (this.StartAtPointer)
104 | {
105 | targetMargin = new Thickness(
106 | mousePosition.X - targetWidth / 2,
107 | mousePosition.Y - targetWidth / 2,
108 | mousePosition.X - targetWidth / 2,
109 | mousePosition.Y - targetWidth / 2);
110 | }
111 |
112 | var marginAnimation = new ThicknessAnimation(startMargin, targetMargin, duration);
113 |
114 | // Animate ellipse Opacity
115 | var opacityAnimation = new DoubleAnimation(1, 0, afterDuration);
116 |
117 | this.ellipse.BeginAnimation(WidthProperty, widthAnimation);
118 | this.ellipse.BeginAnimation(MarginProperty, marginAnimation);
119 | this.ellipse.BeginAnimation(OpacityProperty, opacityAnimation);
120 | }
121 |
122 | protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e)
123 | {
124 | base.OnPreviewMouseLeftButtonDown(e);
125 |
126 | if (this.DoRippleOnMouseClick)
127 | {
128 | this.DoRippple();
129 | }
130 | }
131 | }
132 | }
133 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/SharedAssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 |
3 | [assembly: AssemblyCompany("Digimezzo")]
4 | [assembly: AssemblyCopyright("Copyright Digimezzo © 2015 - 2016")]
5 | [assembly: AssemblyVersion("1.1.0.0")]
6 | [assembly: AssemblyFileVersion("1.1.0.0")]
7 | [assembly: AssemblyInformationalVersion("1.1.0.0")]
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/SplitView.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using System.Windows.Controls;
4 | using System.Windows.Media.Animation;
5 |
6 | namespace Digimezzo.WPFControls
7 | {
8 | public class SplitView : Control
9 | {
10 | private ContentPresenter pane;
11 | private ContentPresenter content;
12 |
13 | public object Pane
14 | {
15 | get { return (object)GetValue(PaneProperty); }
16 | set { SetValue(PaneProperty, value); }
17 | }
18 |
19 | public static readonly DependencyProperty PaneProperty =
20 | DependencyProperty.Register(nameof(Pane), typeof(object), typeof(SplitView), new PropertyMetadata(null));
21 |
22 | public object Content
23 | {
24 | get { return (object)GetValue(ContentProperty); }
25 | set { SetValue(ContentProperty, value); }
26 | }
27 |
28 | public static readonly DependencyProperty ContentProperty =
29 | DependencyProperty.Register(nameof(Content), typeof(object), typeof(SplitView), new PropertyMetadata(null));
30 |
31 | public bool IsPaneOpen
32 | {
33 | get { return (bool)GetValue(IsPaneOpenProperty); }
34 | set { SetValue(IsPaneOpenProperty, value); }
35 | }
36 |
37 | public static readonly DependencyProperty IsPaneOpenProperty =
38 | DependencyProperty.Register(nameof(IsPaneOpen), typeof(bool), typeof(SplitView), new PropertyMetadata(false, OnIsPaneOpenChanged));
39 |
40 |
41 | public double OpenPaneLength
42 | {
43 | get { return (double)GetValue(OpenPaneLengthProperty); }
44 | set { SetValue(OpenPaneLengthProperty, value); }
45 | }
46 |
47 | public static readonly DependencyProperty OpenPaneLengthProperty =
48 | DependencyProperty.Register(nameof(OpenPaneLength), typeof(double), typeof(SplitView), new PropertyMetadata(200.0));
49 |
50 | public event EventHandler PaneClosed = delegate { };
51 |
52 | private static void OnIsPaneOpenChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
53 | {
54 | SplitView splitView = o as SplitView;
55 | bool isPaneOpen = (bool)e.NewValue;
56 |
57 | if (isPaneOpen)
58 | {
59 | splitView.OpenPane();
60 | }
61 | else
62 | {
63 | splitView.ClosePane();
64 | }
65 | }
66 |
67 | static SplitView()
68 | {
69 | DefaultStyleKeyProperty.OverrideMetadata(typeof(SplitView), new FrameworkPropertyMetadata(typeof(SplitView)));
70 | }
71 |
72 | public override void OnApplyTemplate()
73 | {
74 | base.OnApplyTemplate();
75 |
76 | this.pane = (ContentPresenter)GetTemplateChild("PART_Pane");
77 | this.content = (ContentPresenter)GetTemplateChild("PART_Content");
78 |
79 | if (this.pane != null)
80 | {
81 | this.pane.Margin = new Thickness(-this.OpenPaneLength - 1, 0, 0, 0);
82 | }
83 |
84 | if (this.content != null)
85 | {
86 | this.content.MouseUp += Content_MouseUp;
87 | }
88 | }
89 |
90 | private void Content_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
91 | {
92 | this.IsPaneOpen = false;
93 | }
94 |
95 | private void OpenPane()
96 | {
97 | if (this.pane != null)
98 | {
99 | var marginAnimation = new ThicknessAnimation
100 | {
101 | From = new Thickness(-this.OpenPaneLength - 1, 0, 0, 0),
102 | To = new Thickness(0, 0, 0, 0),
103 | Duration = TimeSpan.FromMilliseconds(150)
104 | };
105 |
106 | this.pane.BeginAnimation(ContentPresenter.MarginProperty, marginAnimation);
107 | }
108 | }
109 | private void ClosePane()
110 | {
111 | if (this.pane != null)
112 | {
113 | var marginAnimation = new ThicknessAnimation
114 | {
115 | From = new Thickness(0, 0, 0, 0),
116 | To = new Thickness(-this.OpenPaneLength - 1, 0, 0, 0),
117 | Duration = TimeSpan.FromMilliseconds(150)
118 | };
119 |
120 | this.pane.BeginAnimation(ContentPresenter.MarginProperty, marginAnimation);
121 | }
122 |
123 | this.PaneClosed(this, new EventArgs());
124 | }
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Themes/Generic.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Themes/LabelToLower.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
31 |
32 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Themes/LabelToUpper.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
31 |
32 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Themes/MaterialDateBox.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
35 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Themes/MaterialTextBox.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
28 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Themes/MaterialToggleSwitch.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
69 |
70 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Themes/MultiPanePanel.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
69 |
70 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Themes/PageIndicator.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
37 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Themes/Ripple.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
19 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Themes/SlidingContentControl.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
17 |
18 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Themes/SplitView.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
25 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Themes/ToggleSwitch.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/ToggleSwitch.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using System.Windows.Controls;
4 | using System.Windows.Input;
5 | using System.Windows.Media;
6 |
7 | namespace Digimezzo.WPFControls
8 | {
9 | public class ToggleSwitch : CheckBox
10 | {
11 | private Label onLabel;
12 | private Label offLabel;
13 |
14 | public Brush SwitchBackground
15 | {
16 | get { return (Brush)GetValue(SwitchBackgroundProperty); }
17 | set { SetValue(SwitchBackgroundProperty, value); }
18 | }
19 |
20 | public static readonly DependencyProperty SwitchBackgroundProperty =
21 | DependencyProperty.Register(nameof(SwitchBackground), typeof(Brush), typeof(ToggleSwitch), new PropertyMetadata(new SolidColorBrush(Colors.Blue)));
22 |
23 | public Brush ThumbBackground
24 | {
25 | get { return (Brush)GetValue(ThumbBackgroundProperty); }
26 | set { SetValue(ThumbBackgroundProperty, value); }
27 | }
28 |
29 | public static readonly DependencyProperty ThumbBackgroundProperty =
30 | DependencyProperty.Register(nameof(ThumbBackground), typeof(Brush), typeof(ToggleSwitch), new PropertyMetadata(new SolidColorBrush(Colors.Black)));
31 |
32 | public string OnLabel
33 | {
34 | get { return Convert.ToString(GetValue(OnLabelProperty)); }
35 | set { SetValue(OnLabelProperty, value); }
36 | }
37 |
38 | public static readonly DependencyProperty OnLabelProperty =
39 | DependencyProperty.Register(nameof(OnLabel), typeof(string), typeof(ToggleSwitch), new PropertyMetadata("On"));
40 |
41 | public string OffLabel
42 | {
43 | get { return Convert.ToString(GetValue(OffLabelProperty)); }
44 | set { SetValue(OffLabelProperty, value); }
45 | }
46 |
47 | public static readonly DependencyProperty OffLabelProperty =
48 | DependencyProperty.Register(nameof(OffLabel), typeof(string), typeof(ToggleSwitch), new PropertyMetadata("Off"));
49 |
50 | static ToggleSwitch()
51 | {
52 | DefaultStyleKeyProperty.OverrideMetadata(typeof(ToggleSwitch), new FrameworkPropertyMetadata(typeof(ToggleSwitch)));
53 | }
54 |
55 | public override void OnApplyTemplate()
56 | {
57 | base.OnApplyTemplate();
58 |
59 | this.onLabel = (Label)GetTemplateChild("PART_OnLabel");
60 | this.offLabel = (Label)GetTemplateChild("PART_OffLabel");
61 |
62 | if (this.onLabel != null)
63 | {
64 | this.onLabel.MouseDown += ToggleSwitch_MouseDown;
65 | }
66 |
67 | if (this.offLabel != null)
68 | {
69 | this.offLabel.MouseDown += ToggleSwitch_MouseDown;
70 | }
71 | }
72 |
73 | private void ToggleSwitch_MouseDown(object sender, MouseButtonEventArgs e)
74 | {
75 | e.Handled = true;
76 | }
77 | }
78 | }
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/UWPSlider.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using System.Windows.Media;
4 | using Digimezzo.WPFControls.Base;
5 |
6 | namespace Digimezzo.WPFControls
7 | {
8 | public class HorizontalUWPSlider : HorizontalWindows8Slider
9 | {
10 | public double BarFillPosition
11 | {
12 | get { return Convert.ToDouble(BarFillPositionProperty); }
13 | set { SetValue(BarFillPositionProperty, value); }
14 | }
15 |
16 | public static readonly DependencyProperty BarFillPositionProperty =
17 | DependencyProperty.Register(nameof(BarFillPosition), typeof(double), typeof(HorizontalUWPSlider), new PropertyMetadata(0.0));
18 |
19 | public Brush ButtonInnerBackground
20 | {
21 | get { return (Brush)GetValue(ButtonInnerBackgroundProperty); }
22 | set { SetValue(ButtonInnerBackgroundProperty, value); }
23 | }
24 |
25 | public static readonly DependencyProperty ButtonInnerBackgroundProperty =
26 | DependencyProperty.Register(nameof(ButtonInnerBackground), typeof(Brush), typeof(HorizontalUWPSlider), new PropertyMetadata(null));
27 |
28 | static HorizontalUWPSlider()
29 | {
30 | DefaultStyleKeyProperty.OverrideMetadata(typeof(HorizontalUWPSlider), new FrameworkPropertyMetadata(typeof(HorizontalUWPSlider)));
31 | }
32 |
33 | protected override void UpdatePosition()
34 | {
35 | base.UpdatePosition();
36 | this.CalculateVisibleLengths();
37 | }
38 |
39 | protected override void CalculatePosition()
40 | {
41 | base.CalculatePosition();
42 | this.CalculateVisibleLengths();
43 | }
44 |
45 | protected virtual void CalculateVisibleLengths()
46 | {
47 | if (this.sliderCanvas != null && this.sliderCanvas.ActualWidth != 0 && this.sliderButton != null)
48 | {
49 | this.BarFillPosition = this.Position * (this.sliderCanvas.ActualWidth - Constants.UWPSliderCanvasLengthOffset) /
50 | this.sliderCanvas.ActualWidth;
51 | }
52 | }
53 | }
54 |
55 | public class HorizontalUWPBottomSlider : HorizontalUWPSlider
56 | {
57 | private static readonly CornerRadius rightCornerRadius = new CornerRadius(Constants.UWPSliderBaseUnit, Constants.UWPSliderBaseUnit, 0, Constants.UWPSliderBaseUnit);
58 | private static readonly CornerRadius leftCornerRadius = new CornerRadius(Constants.UWPSliderBaseUnit, Constants.UWPSliderBaseUnit, Constants.UWPSliderBaseUnit, 0);
59 | private static readonly Thickness rightButtonMargin = new Thickness(-24, 0, 0, 0);
60 | private static readonly Thickness leftButtonMargin = new Thickness(-8, 0, 0, 0);
61 | private static readonly double leftButtonBorderLeft = 20;
62 | private static readonly double rightButtonBorderLeft = 4;
63 | private CornerRadius SliderButtonCornerRadius
64 | {
65 | get { return (CornerRadius)GetValue(SliderButtonCornerRadiusProperty); }
66 | set { SetValue(SliderButtonCornerRadiusProperty, value); }
67 | }
68 |
69 | private static readonly DependencyProperty SliderButtonCornerRadiusProperty =
70 | DependencyProperty.Register(nameof(SliderButtonCornerRadius), typeof(CornerRadius), typeof(HorizontalUWPBottomSlider), new PropertyMetadata(null));
71 |
72 | private Thickness SliderButtonMargin
73 | {
74 | get { return (Thickness)GetValue(SliderButtonMarginProperty); }
75 | set { SetValue(SliderButtonMarginProperty, value); }
76 | }
77 |
78 | private static readonly DependencyProperty SliderButtonMarginProperty =
79 | DependencyProperty.Register(nameof(SliderButtonMargin), typeof(Thickness), typeof(HorizontalUWPBottomSlider), new PropertyMetadata(null));
80 |
81 | private double SliderButtonBorderLeft
82 | {
83 | get { return (double)GetValue(SliderButtonBorderLeftProperty); }
84 | set { SetValue(SliderButtonBorderLeftProperty, value); }
85 | }
86 |
87 | private static readonly DependencyProperty SliderButtonBorderLeftProperty =
88 | DependencyProperty.Register(nameof(SliderButtonBorderLeft), typeof(double), typeof(HorizontalUWPBottomSlider), new PropertyMetadata(null));
89 |
90 | static HorizontalUWPBottomSlider()
91 | {
92 | DefaultStyleKeyProperty.OverrideMetadata(typeof(HorizontalUWPBottomSlider), new FrameworkPropertyMetadata(typeof(HorizontalUWPBottomSlider)));
93 | }
94 |
95 | protected override void CalculateVisibleLengths()
96 | {
97 | if (this.sliderCanvas == null) return;
98 |
99 | if (this.Position > this.sliderCanvas.ActualWidth / 2)
100 | {
101 | this.SliderButtonCornerRadius = rightCornerRadius;
102 | this.SliderButtonMargin = rightButtonMargin;
103 | this.SliderButtonBorderLeft= rightButtonBorderLeft;
104 | this.BarFillPosition = this.Position ;
105 | }
106 | else
107 | {
108 | this.SliderButtonCornerRadius = leftCornerRadius;
109 | this.SliderButtonMargin = leftButtonMargin;
110 | this.SliderButtonBorderLeft = leftButtonBorderLeft;
111 | this.BarFillPosition = this.Position;
112 | }
113 | }
114 | }
115 |
116 | public class VerticalUWPSlider : VerticalWindows8Slider
117 | {
118 | #region Properties
119 | public double BarFillPosition
120 | {
121 | get { return Convert.ToDouble(BarFillPositionProperty); }
122 | set { SetValue(BarFillPositionProperty, value); }
123 | }
124 | public Brush ButtonInnerBackground
125 | {
126 | get { return (Brush)GetValue(ButtonInnerBackgroundProperty); }
127 | set { SetValue(ButtonInnerBackgroundProperty, value); }
128 | }
129 | #endregion
130 |
131 | #region DependencyProperty
132 | public static readonly DependencyProperty BarFillPositionProperty = DependencyProperty.Register("BarFillPosition", typeof(double), typeof(VerticalUWPSlider), new PropertyMetadata(0.0));
133 | public static readonly DependencyProperty ButtonInnerBackgroundProperty = DependencyProperty.Register("ButtonInnerBackground", typeof(Brush), typeof(VerticalUWPSlider), new PropertyMetadata(null));
134 | #endregion
135 |
136 | #region Construction
137 | static VerticalUWPSlider()
138 | {
139 | DefaultStyleKeyProperty.OverrideMetadata(typeof(VerticalUWPSlider), new FrameworkPropertyMetadata(typeof(VerticalUWPSlider)));
140 | }
141 | #endregion
142 |
143 | #region Protected
144 | protected override void UpdatePosition()
145 | {
146 | base.UpdatePosition();
147 | this.CalculateVisibleLengths();
148 | }
149 |
150 | protected override void CalculatePosition()
151 | {
152 | base.CalculatePosition();
153 | this.CalculateVisibleLengths();
154 | }
155 | #endregion
156 |
157 | #region Private
158 | private void CalculateVisibleLengths()
159 | {
160 | if (this.sliderCanvas != null && this.sliderCanvas.ActualWidth != 0 && this.sliderButton != null)
161 | {
162 | this.BarFillPosition = this.Position * (this.sliderCanvas.ActualHeight - Constants.UWPSliderCanvasLengthOffset) /
163 | this.sliderCanvas.ActualHeight;
164 | }
165 | }
166 | #endregion
167 | }
168 | }
169 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Utils/AnimationUtils.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using System.Windows.Media;
4 | using System.Windows.Media.Animation;
5 | using System.Windows.Media.Imaging;
6 |
7 | namespace Digimezzo.WPFControls.Utils
8 | {
9 | public sealed class AnimationUtils
10 | {
11 | public static AnimationTimeline CreateSlideAnimation(double from, double to, double easingAmplitude, double slideDuration, EventHandler whenDone = null)
12 | {
13 | IEasingFunction ease = new BackEase
14 | {
15 | Amplitude = easingAmplitude,
16 | EasingMode = EasingMode.EaseOut
17 | };
18 |
19 | var duration = new Duration(TimeSpan.FromSeconds(slideDuration));
20 | var anim = new DoubleAnimation(from, to, duration) { EasingFunction = ease };
21 |
22 | if (whenDone != null) anim.Completed += whenDone;
23 |
24 | anim.Freeze();
25 |
26 | return anim;
27 | }
28 |
29 | public static AnimationTimeline CreateFadeAnimation(double from, double to, double durationSeconds, EventHandler whenDone = null)
30 | {
31 | var duration = new Duration(TimeSpan.FromSeconds(durationSeconds));
32 | var anim = new DoubleAnimation(from, to, duration);
33 |
34 | if (whenDone != null)
35 | {
36 | anim.Completed += whenDone;
37 | }
38 |
39 | anim.Freeze();
40 |
41 | return anim;
42 | }
43 |
44 | public static Brush CreateBrushFromVisual(Visual visual, double desiredWidth, double desiredHeight)
45 | {
46 | if (visual == null)
47 | {
48 | throw new ArgumentNullException("visual");
49 | }
50 |
51 | var target = new RenderTargetBitmap(Convert.ToInt32(desiredWidth), Convert.ToInt32(desiredHeight), 96, 96, PixelFormats.Pbgra32);
52 | target.Render(visual);
53 | var brush = new ImageBrush(target);
54 | brush.Freeze();
55 | return brush;
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Utils/UriUtils.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Digimezzo.WPFControls.Utils
4 | {
5 | public class UriUtils
6 | {
7 | public static Uri MakePackUri(string relativeFile)
8 | {
9 | var a = typeof(T).Assembly;
10 | var assemblyShortName = a.ToString().Split(',')[0];
11 | var uriString = $"pack://application:,,,/{assemblyShortName};component/{relativeFile}";
12 |
13 | return new Uri(uriString);
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Utils/VisualTreeUtils.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Media;
3 | using System.Windows.Media.Media3D;
4 |
5 | namespace Digimezzo.WPFControls.Utils
6 | {
7 | public sealed class VisualTreeUtils
8 | {
9 | public static T FindAncestor(DependencyObject d) where T : class
10 | {
11 | if (d is Visual || d is Visual3D)
12 | {
13 | DependencyObject item = VisualTreeHelper.GetParent(d);
14 |
15 | while (item != null)
16 | {
17 | T itemAsT = item as T;
18 | if (itemAsT != null)
19 | {
20 | return itemAsT;
21 | }
22 | item = VisualTreeHelper.GetParent(item);
23 | }
24 | }
25 |
26 | return null;
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/ValidationRules/IntValidation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows.Controls;
4 |
5 | namespace Digimezzo.WPFControls.ValidationRules
6 | {
7 | public class IntValidation : ValidationRule
8 | {
9 | public int Maximum { get; set; }
10 |
11 | public int Minimum { get; set; } = 0;
12 |
13 | public override ValidationResult Validate(object value, CultureInfo cultureInfo)
14 | {
15 | try
16 | {
17 | var num = Convert.ToInt32((string) value);
18 | if (Minimum > num || num > Maximum)
19 | {
20 | return new ValidationResult(false, value);
21 | }
22 | }
23 | catch
24 | {
25 | return new ValidationResult(false, value);
26 | }
27 |
28 | return new ValidationResult(true, value);
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/ValidationRules/RegexValidation.cs:
--------------------------------------------------------------------------------
1 | using System.Globalization;
2 | using System.Text.RegularExpressions;
3 | using System.Windows.Controls;
4 |
5 | namespace Digimezzo.WPFControls.ValidationRules
6 | {
7 | public class RegexValidation : ValidationRule
8 | {
9 | public string Pattern
10 | {
11 | get => _pattern;
12 | set
13 | {
14 | _pattern = value;
15 | _isRegexChanged = true;
16 | }
17 | }
18 |
19 | private string _pattern;
20 | private bool _isRegexChanged = false;
21 | private Regex _regex;
22 |
23 | public override ValidationResult Validate(object value, CultureInfo cultureInfo)
24 | {
25 | if (_isRegexChanged)
26 | {
27 | _regex = new Regex(_pattern);
28 | _isRegexChanged = false;
29 | }
30 |
31 | return new ValidationResult(_regex.IsMatch((string) value), value);
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Windows10Slider.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace Digimezzo.WPFControls
4 | {
5 | public class HorizontalWindows10Slider : HorizontalWindows8Slider
6 | {
7 | static HorizontalWindows10Slider()
8 | {
9 | DefaultStyleKeyProperty.OverrideMetadata(typeof(HorizontalWindows10Slider), new FrameworkPropertyMetadata(typeof(HorizontalWindows10Slider)));
10 | }
11 | }
12 |
13 | public class VerticalWindows10Slider : VerticalWindows8Slider
14 | {
15 | static VerticalWindows10Slider()
16 | {
17 | DefaultStyleKeyProperty.OverrideMetadata(typeof(VerticalWindows10Slider), new FrameworkPropertyMetadata(typeof(VerticalWindows10Slider)));
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Windows10ToggleSwitch.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using System.Windows.Controls;
4 | using System.Windows.Media;
5 |
6 | namespace Digimezzo.WPFControls
7 | {
8 | public class Windows10ToggleSwitch : CheckBox
9 | {
10 | public Brush Accent
11 | {
12 | get { return (Brush)GetValue(AccentProperty); }
13 | set { SetValue(AccentProperty, value); }
14 | }
15 |
16 | public static readonly DependencyProperty AccentProperty =
17 | DependencyProperty.Register(nameof(Accent), typeof(Brush), typeof(Windows10ToggleSwitch), new PropertyMetadata(new SolidColorBrush(Colors.Blue)));
18 |
19 | public string OnLabel
20 | {
21 | get { return Convert.ToString(GetValue(OnLabelProperty)); }
22 | set { SetValue(OnLabelProperty, value); }
23 | }
24 |
25 | public static readonly DependencyProperty OnLabelProperty =
26 | DependencyProperty.Register(nameof(OnLabel), typeof(string), typeof(Windows10ToggleSwitch), new PropertyMetadata("On"));
27 |
28 | public string OffLabel
29 | {
30 | get { return Convert.ToString(GetValue(OffLabelProperty)); }
31 | set { SetValue(OffLabelProperty, value); }
32 | }
33 |
34 | public static readonly DependencyProperty OffLabelProperty =
35 | DependencyProperty.Register(nameof(OffLabel), typeof(string), typeof(Windows10ToggleSwitch), new PropertyMetadata("Off"));
36 |
37 | static Windows10ToggleSwitch()
38 | {
39 | DefaultStyleKeyProperty.OverrideMetadata(typeof(Windows10ToggleSwitch), new FrameworkPropertyMetadata(typeof(Windows10ToggleSwitch)));
40 | }
41 | }
42 | }
--------------------------------------------------------------------------------
/Digimezzo.WPFControls/Windows8Slider.cs:
--------------------------------------------------------------------------------
1 | using Digimezzo.WPFControls.Base;
2 | using System.Windows;
3 | using System.Windows.Input;
4 |
5 | namespace Digimezzo.WPFControls
6 | {
7 | public class HorizontalWindows8Slider : SliderBase
8 | {
9 | static HorizontalWindows8Slider()
10 | {
11 | DefaultStyleKeyProperty.OverrideMetadata(typeof(HorizontalWindows8Slider), new FrameworkPropertyMetadata(typeof(HorizontalWindows8Slider)));
12 | }
13 |
14 | protected override void UpdatePosition()
15 | {
16 | if (this.sliderCanvas == null) return;
17 |
18 | this.Position = Mouse.GetPosition(this.sliderCanvas).X;
19 |
20 | if (this.Position > this.sliderCanvas.ActualWidth)
21 | {
22 | this.Position = this.sliderCanvas.ActualWidth;
23 | }
24 |
25 | if (this.Position < 0.0)
26 | {
27 | this.Position = 0.0;
28 | }
29 | }
30 |
31 | protected override void CalculatePosition()
32 | {
33 | if (this.sliderCanvas == null) return;
34 |
35 | if (!this.isCalculating)
36 | {
37 | this.isCalculating = true;
38 |
39 | if ((this.Maximum - this.Minimum) > 0 && this.sliderCanvas.ActualWidth > 0)
40 | {
41 | this.Position = ((this.Value -this.Minimum) / (this.Maximum - this.Minimum)) * this.sliderCanvas.ActualWidth;
42 | }
43 | else
44 | {
45 | this.Position = 0;
46 | }
47 |
48 | this.isCalculating = false;
49 | }
50 | }
51 |
52 | protected override void CalculateValue()
53 | {
54 | if (this.sliderCanvas == null) return;
55 |
56 | if (!this.isCalculating)
57 | {
58 | this.isCalculating = true;
59 |
60 | if ( this.sliderCanvas.ActualWidth > 0)
61 | {
62 | this.Value = ((this.Position * (this.Maximum - this.Minimum)) / this.sliderCanvas.ActualWidth) + this.Minimum;
63 | }
64 | else
65 | {
66 | this.Value = 0;
67 | }
68 |
69 | this.isCalculating = false;
70 | }
71 |
72 | }
73 | }
74 |
75 | public class VerticalWindows8Slider : SliderBase
76 | {
77 |
78 | static VerticalWindows8Slider()
79 | {
80 | DefaultStyleKeyProperty.OverrideMetadata(typeof(VerticalWindows8Slider), new FrameworkPropertyMetadata(typeof(VerticalWindows8Slider)));
81 | }
82 |
83 | protected override void UpdatePosition()
84 | {
85 | if (this.sliderCanvas == null) return;
86 |
87 | this.Position = this.sliderCanvas.ActualHeight - Mouse.GetPosition(this.sliderCanvas).Y;
88 |
89 | if (this.Position > this.sliderCanvas.ActualHeight)
90 | {
91 | this.Position = this.sliderCanvas.ActualHeight;
92 | }
93 |
94 | if (this.Position < 0.0)
95 | {
96 | this.Position = 0.0;
97 | }
98 |
99 | }
100 |
101 | protected override void CalculatePosition()
102 | {
103 | if (this.sliderCanvas == null) return;
104 |
105 | if (!this.isCalculating)
106 | {
107 | this.isCalculating = true;
108 |
109 | if ((this.Maximum - this.Minimum) > 0 && this.sliderCanvas.ActualHeight > 0)
110 | {
111 | this.Position = ((this.Value - this.Minimum) / (this.Maximum - this.Minimum)) * this.sliderCanvas.ActualHeight;
112 | }
113 | else
114 | {
115 | this.Position = 0;
116 | }
117 |
118 | this.isCalculating = false;
119 | }
120 | }
121 |
122 | protected override void CalculateValue()
123 | {
124 | if (this.sliderCanvas == null) return;
125 |
126 | if (!this.isCalculating)
127 | {
128 | this.isCalculating = true;
129 |
130 | if ( this.sliderCanvas.ActualHeight > 0)
131 | {
132 | this.Value = ((this.Position * (this.Maximum - this.Minimum)) / this.sliderCanvas.ActualHeight) + this.Minimum;
133 | }
134 | else
135 | {
136 | this.Value = 0;
137 | }
138 |
139 | this.isCalculating = false;
140 | }
141 | }
142 | }
143 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 Digimezzo
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 | # WPFControls (deprecated by Foundation project)
2 |
3 | WPFControls contains some simple controls which can be used in WPF projects.
4 | Their usage is best described by the tests which are included in the project.
5 |
6 | [](https://github.com/digimezzo/WPFControls/releases/latest)
7 | [](https://github.com/digimezzo/WPFControls/issues)
8 | [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MQALEWTEZ7HX8)
9 |
10 | ### Controls ###
11 |
12 | - **BorderlessWindows8Window**: borderless window that has the look and feel of windows in Windows 8
13 | - **BorderlessWindows10Window**: borderless window that has the look and feel of windows in Windows 10
14 | - **LabelToLower**: label that converts its text to lower case
15 | - **LabelToUpper**:label that converts its text to upper case
16 | - **MultiPanePanel**: panel with 2 or 3 resizable (draggable) panes
17 | - **MultiSelectListBox**: ListBox that doesn't lose selection of multiple items when starting a mouse drag operation
18 | - **Pivot**: UWP-like Pivot control
19 | - **ProgressRing**: Windows Modern UI progress ring
20 | - **SlidingContentControl**: ContentControl that slides and fades in its content on content change
21 | - **ToggleSwitch**: custom toggle switch
22 | - **UWPSlider**: slider that has a UWP look and feel
23 | - **VirtualizingWrapPanel**: WrapPanel that virtualizes its child collection
24 | - **Windows8Slider**: slider that has a Windows 8 look and feel
25 | - **Windows10Slider**: slider that has a Windows 10 look and feel
26 | - **Windows10ToggleSwitch**: toggle switch with Windows 10 look and feel
27 |
28 | These controls are showcased in my other projects [Dopamine](https://github.com/digimezzo/Dopamine) and [Knowte](https://github.com/digimezzo/Knowte).
29 |
--------------------------------------------------------------------------------
/WPFControls.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}") = "Digimezzo.WPFControls", "Digimezzo.WPFControls\Digimezzo.WPFControls.csproj", "{14CAB61B-42EA-4DAE-B79B-65A246D2A585}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Digimezzo.WPFControls.Tests", "Digimezzo.WPFControls.Tests\Digimezzo.WPFControls.Tests.csproj", "{0A622E8A-9ED7-4B15-9F0D-5F6CFB05D251}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {14CAB61B-42EA-4DAE-B79B-65A246D2A585}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {14CAB61B-42EA-4DAE-B79B-65A246D2A585}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {14CAB61B-42EA-4DAE-B79B-65A246D2A585}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {14CAB61B-42EA-4DAE-B79B-65A246D2A585}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {0A622E8A-9ED7-4B15-9F0D-5F6CFB05D251}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {0A622E8A-9ED7-4B15-9F0D-5F6CFB05D251}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {0A622E8A-9ED7-4B15-9F0D-5F6CFB05D251}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {0A622E8A-9ED7-4B15-9F0D-5F6CFB05D251}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------