├── .gitattributes
├── .gitignore
├── LICENSE
├── README.md
└── src
├── PhotonTheme.WpfDemo
├── App.xaml
├── App.xaml.cs
├── Buttons.xaml
├── Buttons.xaml.cs
├── Colors.xaml
├── Colors.xaml.cs
├── Fields.xaml
├── Fields.xaml.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── PhotonTheme.WpfDemo.csproj
├── Typography.xaml
└── Typography.xaml.cs
├── PhotonTheme.sln
└── PhotonTheme
├── Controls
├── ControlzEx
│ └── PackIconBase.cs
├── Enums
│ ├── BindingUpdateTrigger.cs
│ └── VerificationResult.cs
├── Extensions
│ ├── ButtonExtension.cs
│ ├── FieldExtension.cs
│ ├── PackIconExtension.cs
│ ├── ScrollBarExtension.cs
│ └── ShadowExtension.cs
├── Interfaces
│ └── IVerificationField.cs
├── PackIcon
│ ├── PackIcon.cs
│ ├── PackIconDataFactory.cs
│ └── PackIconKind.cs
└── VerificationBox.cs
├── PhotonTheme.csproj
├── PhotonTheme.csproj.DotSettings
├── Themes
├── Base
│ ├── ButtonBase.xaml
│ ├── CheckBoxBase.xaml
│ ├── ScrollBarBase.xaml
│ ├── TabControlBase.xaml
│ ├── TextBlockBase.xaml
│ ├── TextBoxBase.xaml
│ └── VerificationBoxBase.xaml
├── Defaults.xaml
├── General
│ ├── Colors.xaml
│ ├── Fonts.xaml
│ └── Shadows.xaml
├── Generic.xaml
└── Styles
│ ├── Button.xaml
│ ├── CheckBox.xaml
│ ├── ScrollBar.xaml
│ ├── TabControl.xaml
│ ├── TextBlock.xaml
│ ├── TextBox.xaml
│ └── VerificationBox.xaml
└── Utilities
├── Converters
├── NullToVisibilityConverter.cs
├── ShadowConverter.cs
├── ShadowInfo.cs
└── StringToVisibility.cs
└── Resources
└── Lato
├── Lato-Black.ttf
├── Lato-BlackItalic.ttf
├── Lato-Bold.ttf
├── Lato-BoldItalic.ttf
├── Lato-Hairline.ttf
├── Lato-HairlineItalic.ttf
├── Lato-Italic.ttf
├── Lato-Light.ttf
├── Lato-LightItalic.ttf
├── Lato-Regular.ttf
└── OFL.txt
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Build results
17 | [Dd]ebug/
18 | [Dd]ebugPublic/
19 | [Rr]elease/
20 | [Rr]eleases/
21 | x64/
22 | x86/
23 | bld/
24 | [Bb]in/
25 | [Oo]bj/
26 | [Ll]og/
27 |
28 | # Visual Studio 2015/2017 cache/options directory
29 | .vs/
30 | # Uncomment if you have tasks that create the project's static files in wwwroot
31 | #wwwroot/
32 |
33 | # Visual Studio 2017 auto generated files
34 | Generated\ Files/
35 |
36 | # MSTest test Results
37 | [Tt]est[Rr]esult*/
38 | [Bb]uild[Ll]og.*
39 |
40 | # NUNIT
41 | *.VisualState.xml
42 | TestResult.xml
43 |
44 | # Build Results of an ATL Project
45 | [Dd]ebugPS/
46 | [Rr]eleasePS/
47 | dlldata.c
48 |
49 | # Benchmark Results
50 | BenchmarkDotNet.Artifacts/
51 |
52 | # .NET Core
53 | project.lock.json
54 | project.fragment.lock.json
55 | artifacts/
56 |
57 | # StyleCop
58 | StyleCopReport.xml
59 |
60 | # Files built by Visual Studio
61 | *_i.c
62 | *_p.c
63 | *_h.h
64 | *.ilk
65 | *.meta
66 | *.obj
67 | *.iobj
68 | *.pch
69 | *.pdb
70 | *.ipdb
71 | *.pgc
72 | *.pgd
73 | *.rsp
74 | *.sbr
75 | *.tlb
76 | *.tli
77 | *.tlh
78 | *.tmp
79 | *.tmp_proj
80 | *_wpftmp.csproj
81 | *.log
82 | *.vspscc
83 | *.vssscc
84 | .builds
85 | *.pidb
86 | *.svclog
87 | *.scc
88 |
89 | # Chutzpah Test files
90 | _Chutzpah*
91 |
92 | # Visual C++ cache files
93 | ipch/
94 | *.aps
95 | *.ncb
96 | *.opendb
97 | *.opensdf
98 | *.sdf
99 | *.cachefile
100 | *.VC.db
101 | *.VC.VC.opendb
102 |
103 | # Visual Studio profiler
104 | *.psess
105 | *.vsp
106 | *.vspx
107 | *.sap
108 |
109 | # Visual Studio Trace Files
110 | *.e2e
111 |
112 | # TFS 2012 Local Workspace
113 | $tf/
114 |
115 | # Guidance Automation Toolkit
116 | *.gpState
117 |
118 | # ReSharper is a .NET coding add-in
119 | _ReSharper*/
120 | *.[Rr]e[Ss]harper
121 | *.DotSettings.user
122 |
123 | # JustCode is a .NET coding add-in
124 | .JustCode
125 |
126 | # TeamCity is a build add-in
127 | _TeamCity*
128 |
129 | # DotCover is a Code Coverage Tool
130 | *.dotCover
131 |
132 | # AxoCover is a Code Coverage Tool
133 | .axoCover/*
134 | !.axoCover/settings.json
135 |
136 | # Visual Studio code coverage results
137 | *.coverage
138 | *.coveragexml
139 |
140 | # NCrunch
141 | _NCrunch_*
142 | .*crunch*.local.xml
143 | nCrunchTemp_*
144 |
145 | # MightyMoose
146 | *.mm.*
147 | AutoTest.Net/
148 |
149 | # Web workbench (sass)
150 | .sass-cache/
151 |
152 | # Installshield output folder
153 | [Ee]xpress/
154 |
155 | # DocProject is a documentation generator add-in
156 | DocProject/buildhelp/
157 | DocProject/Help/*.HxT
158 | DocProject/Help/*.HxC
159 | DocProject/Help/*.hhc
160 | DocProject/Help/*.hhk
161 | DocProject/Help/*.hhp
162 | DocProject/Help/Html2
163 | DocProject/Help/html
164 |
165 | # Click-Once directory
166 | publish/
167 |
168 | # Publish Web Output
169 | *.[Pp]ublish.xml
170 | *.azurePubxml
171 | # Note: Comment the next line if you want to checkin your web deploy settings,
172 | # but database connection strings (with potential passwords) will be unencrypted
173 | *.pubxml
174 | *.publishproj
175 |
176 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
177 | # checkin your Azure Web App publish settings, but sensitive information contained
178 | # in these scripts will be unencrypted
179 | PublishScripts/
180 |
181 | # NuGet Packages
182 | *.nupkg
183 | # The packages folder can be ignored because of Package Restore
184 | **/[Pp]ackages/*
185 | # except build/, which is used as an MSBuild target.
186 | !**/[Pp]ackages/build/
187 | # Uncomment if necessary however generally it will be regenerated when needed
188 | #!**/[Pp]ackages/repositories.config
189 | # NuGet v3's project.json files produces more ignorable files
190 | *.nuget.props
191 | *.nuget.targets
192 |
193 | # Microsoft Azure Build Output
194 | csx/
195 | *.build.csdef
196 |
197 | # Microsoft Azure Emulator
198 | ecf/
199 | rcf/
200 |
201 | # Windows Store app package directories and files
202 | AppPackages/
203 | BundleArtifacts/
204 | Package.StoreAssociation.xml
205 | _pkginfo.txt
206 | *.appx
207 |
208 | # Visual Studio cache files
209 | # files ending in .cache can be ignored
210 | *.[Cc]ache
211 | # but keep track of directories ending in .cache
212 | !*.[Cc]ache/
213 |
214 | # Others
215 | ClientBin/
216 | ~$*
217 | *~
218 | *.dbmdl
219 | *.dbproj.schemaview
220 | *.jfm
221 | *.pfx
222 | *.publishsettings
223 | orleans.codegen.cs
224 |
225 | # Including strong name files can present a security risk
226 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
227 | #*.snk
228 |
229 | # Since there are multiple workflows, uncomment next line to ignore bower_components
230 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
231 | #bower_components/
232 |
233 | # RIA/Silverlight projects
234 | Generated_Code/
235 |
236 | # Backup & report files from converting an old project file
237 | # to a newer Visual Studio version. Backup files are not needed,
238 | # because we have git ;-)
239 | _UpgradeReport_Files/
240 | Backup*/
241 | UpgradeLog*.XML
242 | UpgradeLog*.htm
243 | ServiceFabricBackup/
244 | *.rptproj.bak
245 |
246 | # SQL Server files
247 | *.mdf
248 | *.ldf
249 | *.ndf
250 |
251 | # Business Intelligence projects
252 | *.rdl.data
253 | *.bim.layout
254 | *.bim_*.settings
255 | *.rptproj.rsuser
256 |
257 | # Microsoft Fakes
258 | FakesAssemblies/
259 |
260 | # GhostDoc plugin setting file
261 | *.GhostDoc.xml
262 |
263 | # Node.js Tools for Visual Studio
264 | .ntvs_analysis.dat
265 | node_modules/
266 |
267 | # Visual Studio 6 build log
268 | *.plg
269 |
270 | # Visual Studio 6 workspace options file
271 | *.opt
272 |
273 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
274 | *.vbw
275 |
276 | # Visual Studio LightSwitch build output
277 | **/*.HTMLClient/GeneratedArtifacts
278 | **/*.DesktopClient/GeneratedArtifacts
279 | **/*.DesktopClient/ModelManifest.xml
280 | **/*.Server/GeneratedArtifacts
281 | **/*.Server/ModelManifest.xml
282 | _Pvt_Extensions
283 |
284 | # Paket dependency manager
285 | .paket/paket.exe
286 | paket-files/
287 |
288 | # FAKE - F# Make
289 | .fake/
290 |
291 | # JetBrains Rider
292 | .idea/
293 | *.sln.iml
294 |
295 | # CodeRush personal settings
296 | .cr/personal
297 |
298 | # Python Tools for Visual Studio (PTVS)
299 | __pycache__/
300 | *.pyc
301 |
302 | # Cake - Uncomment if you are using it
303 | # tools/**
304 | # !tools/packages.config
305 |
306 | # Tabs Studio
307 | *.tss
308 |
309 | # Telerik's JustMock configuration file
310 | *.jmconfig
311 |
312 | # BizTalk build output
313 | *.btp.cs
314 | *.btm.cs
315 | *.odx.cs
316 | *.xsd.cs
317 |
318 | # OpenCover UI analysis results
319 | OpenCover/
320 |
321 | # Azure Stream Analytics local run output
322 | ASALocalRun/
323 |
324 | # MSBuild Binary and Structured Log
325 | *.binlog
326 |
327 | # NVidia Nsight GPU debugger configuration file
328 | *.nvuser
329 |
330 | # MFractors (Xamarin productivity tool) working folder
331 | .mfractor/
332 |
333 | # Local History for Visual Studio
334 | .localhistory/
335 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Albert Alonso
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 | # PhotonTheme [ In development ]
2 |
3 | This is a Toolkit that tries to help on the modernization of WPF applications.
4 | The inital inspiration for this Design can be found in: [UI Design System](https://uidesignsystem.com/desktop.html)
5 |
6 | Some base controls and mostly the icon pack is from [Material Design Library](https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit), which has done an excelent job on bringing the [Material Design](https://material.io/design/) to WPF.
7 |
8 | This library currently works with **.Net Core 3.0**.
9 |
10 | [](https://www.nuget.org/packages/PhotonTheme/)
11 | [](http://opensource.org/licenses/MIT)
12 |
13 | ## Styles and Controls
14 |
15 |
56 |
57 | ## Getting Started
58 |
59 |
60 | 1. Install the Nuget Package
61 |
62 | `Install-Package PhotonTheme`
63 |
64 | 2. In the App.xaml file, add the following ResourceDictionary:
65 | ```
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 | ```
76 | 3. You can start using all the styles and controls of the Toolkit now.
77 |
78 |
79 | ## License
80 |
81 | This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
82 |
--------------------------------------------------------------------------------
/src/PhotonTheme.WpfDemo/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/PhotonTheme.WpfDemo/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace PhotonTheme.WpfDemo
4 | {
5 | ///
6 | /// Interaction logic for App.xaml
7 | ///
8 | public partial class App : Application
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/PhotonTheme.WpfDemo/Buttons.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
62 |
63 |
67 |
71 |
75 |
76 |
77 |
78 |
79 |
80 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
124 |
128 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
--------------------------------------------------------------------------------
/src/PhotonTheme.WpfDemo/Buttons.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls;
3 | using System.Windows.Media;
4 |
5 | namespace PhotonTheme.WpfDemo
6 | {
7 | ///
8 | /// Interaction logic for Buttons.xaml
9 | ///
10 | public partial class Buttons : UserControl
11 | {
12 | public Buttons()
13 | {
14 | InitializeComponent();
15 | }
16 |
17 | private void ThemeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
18 | {
19 | var combobox = sender as ComboBox;
20 | if (combobox?.SelectedItem == null) return;
21 |
22 | switch (combobox.SelectedIndex)
23 | {
24 | case 1:
25 | ShowcaseButton.Foreground = Helper.Get("DarkForegroundBrush");
26 | ShowcaseButton.Background = Helper.Get("PrimaryBrush");
27 | break;
28 | case 2:
29 | ShowcaseButton.Foreground = Helper.Get("PrimaryBrush");
30 | ShowcaseButton.Background = Helper.Get("LightBrush");
31 | break;
32 | default:
33 | ShowcaseButton.Foreground = Helper.Get("LightForegroundBrush");
34 | ShowcaseButton.Background = Helper.Get("MediumBrush");
35 | break;
36 | }
37 | }
38 |
39 | private void SizeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
40 | {
41 | var combobox = sender as ComboBox;
42 | if (combobox?.SelectedItem == null) return;
43 |
44 | switch (combobox.SelectedIndex)
45 | {
46 | case 0:
47 | ShowcaseButton.FontSize = 16;
48 | break;
49 | case 1:
50 | ShowcaseButton.FontSize = 14;
51 | break;
52 | default:
53 | ShowcaseButton.FontSize = 11;
54 | break;
55 | }
56 | }
57 |
58 | private void BackgroundComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
59 | {
60 | var combobox = sender as ComboBox;
61 | if (combobox?.SelectedItem == null) return;
62 | if (combobox.Items[combobox.SelectedIndex] is ComboBoxItem comboBoxItem)
63 | ShowcaseButton.Background = Helper.Get(comboBoxItem.Content.ToString());
64 | }
65 |
66 | private void ForegroundComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
67 | {
68 | var combobox = sender as ComboBox;
69 | if (combobox?.SelectedItem == null) return;
70 | if (combobox.Items[combobox.SelectedIndex] is ComboBoxItem comboBoxItem)
71 | ShowcaseButton.Foreground = Helper.Get(comboBoxItem.Content.ToString());
72 | }
73 | }
74 |
75 | public static class Helper
76 | {
77 | public static T Get(string resourceName) where T : class
78 | {
79 | return Application.Current.TryFindResource(resourceName) as T;
80 | }
81 | }
82 | }
--------------------------------------------------------------------------------
/src/PhotonTheme.WpfDemo/Colors.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
23 |
28 |
29 |
35 |
40 |
41 |
47 |
52 |
53 |
59 |
64 |
65 |
71 |
76 |
77 |
83 |
88 |
89 |
95 |
100 |
101 |
107 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
--------------------------------------------------------------------------------
/src/PhotonTheme.WpfDemo/Colors.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls;
2 |
3 | namespace PhotonTheme.WpfDemo
4 | {
5 | ///
6 | /// Interaction logic for Colors.xaml
7 | ///
8 | public partial class Colors : UserControl
9 | {
10 | public Colors()
11 | {
12 | InitializeComponent();
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/PhotonTheme.WpfDemo/Fields.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
23 |
24 |
28 |
29 |
33 |
38 |
43 |
44 |
45 |
50 |
51 |
55 |
60 |
66 |
71 |
76 |
77 |
78 |
79 |
80 |
86 |
87 |
91 |
95 |
99 |
103 |
108 |
109 |
110 |
111 |
112 |
--------------------------------------------------------------------------------
/src/PhotonTheme.WpfDemo/Fields.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Windows;
5 | using System.Windows.Controls;
6 | using System.Windows.Data;
7 | using System.Windows.Documents;
8 | using System.Windows.Input;
9 | using System.Windows.Media;
10 | using System.Windows.Media.Imaging;
11 | using System.Windows.Navigation;
12 | using System.Windows.Shapes;
13 | using PhotonTheme.Controls;
14 |
15 | namespace PhotonTheme.WpfDemo
16 | {
17 | ///
18 | /// Interaction logic for Fields.xaml
19 | ///
20 | public partial class Fields : UserControl
21 | {
22 | public Fields()
23 | {
24 | InitializeComponent();
25 |
26 | VerificationBox.VerificationFunction = VerifyPrefix;
27 | VerificationBoxFocus.VerificationFunction = VerifyText;
28 | }
29 |
30 | private static VerificationResult VerifyText(string arg)
31 | {
32 | if (arg.ToLowerInvariant().Equals("success")) return VerificationResult.Success;
33 | if (arg.ToLowerInvariant().Equals("error")) return VerificationResult.Fail;
34 |
35 | return VerificationResult.None;
36 | }
37 |
38 | private static VerificationResult VerifyPrefix(string arg)
39 | {
40 | if (arg.StartsWith("pre")) return VerificationResult.Success;
41 | if (arg.StartsWith("post")) return VerificationResult.Fail;
42 |
43 | return VerificationResult.None;
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/PhotonTheme.WpfDemo/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
13 |
14 |
15 |
16 |
17 |
18 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/src/PhotonTheme.WpfDemo/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace PhotonTheme.WpfDemo
4 | {
5 | ///
6 | /// Interaction logic for MainWindow.xaml
7 | ///
8 | public partial class MainWindow : Window
9 | {
10 | public MainWindow()
11 | {
12 | InitializeComponent();
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/PhotonTheme.WpfDemo/PhotonTheme.WpfDemo.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | netcoreapp3.0
6 | true
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | Buttons.xaml
20 |
21 |
22 | Colors.xaml
23 |
24 |
25 | MainWindow.xaml
26 |
27 |
28 | Typography.xaml
29 |
30 |
31 |
32 |
33 |
34 | Designer
35 |
36 |
37 | Designer
38 |
39 |
40 | Designer
41 | MSBuild:Compile
42 |
43 |
44 | Designer
45 | MSBuild:Compile
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/src/PhotonTheme.WpfDemo/Typography.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
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 |
--------------------------------------------------------------------------------
/src/PhotonTheme.WpfDemo/Typography.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls;
2 |
3 | namespace PhotonTheme.WpfDemo
4 | {
5 | ///
6 | /// Interaction logic for Typography.xaml
7 | ///
8 | public partial class Typography : UserControl
9 | {
10 | public Typography()
11 | {
12 | InitializeComponent();
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/PhotonTheme.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.28803.352
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PhotonTheme.WpfDemo", "PhotonTheme.WpfDemo\PhotonTheme.WpfDemo.csproj", "{82F0DB16-DF5B-40E2-8F69-6F98BF66EB06}"
7 | EndProject
8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PhotonTheme", "PhotonTheme\PhotonTheme.csproj", "{21DC4690-686F-4A3E-B6DD-8D5253B19E87}"
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 | {82F0DB16-DF5B-40E2-8F69-6F98BF66EB06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {82F0DB16-DF5B-40E2-8F69-6F98BF66EB06}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {82F0DB16-DF5B-40E2-8F69-6F98BF66EB06}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {82F0DB16-DF5B-40E2-8F69-6F98BF66EB06}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {21DC4690-686F-4A3E-B6DD-8D5253B19E87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {21DC4690-686F-4A3E-B6DD-8D5253B19E87}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {21DC4690-686F-4A3E-B6DD-8D5253B19E87}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {21DC4690-686F-4A3E-B6DD-8D5253B19E87}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {4F1AC31F-FE88-4C3D-A7A6-C28C2E796215}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/src/PhotonTheme/Controls/ControlzEx/PackIconBase.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Windows;
5 | using System.Windows.Controls;
6 | using System.Windows.Media;
7 |
8 | namespace PhotonTheme.Controls
9 | {
10 | public abstract class PackIconBase : Control
11 | {
12 | internal abstract void UpdateData();
13 | }
14 |
15 | ///
16 | /// Base class for creating an icon control for icon packs.
17 | ///
18 | ///
19 | public abstract class PackIconBase : PackIconBase
20 | {
21 | private static Lazy> _dataIndex;
22 |
23 | ///
24 | /// Inheritors should provide a factory for setting up the path data index (per icon kind).
25 | /// The factory will only be utilised once, across all closed instances (first instantiation wins).
26 | ///
27 | protected PackIconBase(Func> dataIndexFactory)
28 | {
29 | if (dataIndexFactory == null) throw new ArgumentNullException(nameof(dataIndexFactory));
30 |
31 | if (_dataIndex == null)
32 | _dataIndex = new Lazy>(dataIndexFactory);
33 | }
34 |
35 | public static readonly DependencyProperty KindProperty
36 | = DependencyProperty.Register(nameof(Kind), typeof(TKind), typeof(PackIconBase), new PropertyMetadata(default(TKind), KindPropertyChangedCallback));
37 |
38 | private static void KindPropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
39 | {
40 | ((PackIconBase)dependencyObject).UpdateData();
41 | }
42 |
43 | ///
44 | /// Gets or sets the icon to display.
45 | ///
46 | public TKind Kind
47 | {
48 | get => (TKind)GetValue(KindProperty);
49 | set => SetValue(KindProperty, value);
50 | }
51 |
52 | #if NETFX_CORE
53 | private static readonly DependencyProperty DataProperty
54 | = DependencyProperty.Register(nameof(Data), typeof(string), typeof(PackIconBase), new PropertyMetadata(""));
55 |
56 | ///
57 | /// Gets the icon path data for the current .
58 | ///
59 | public string Data
60 | {
61 | get { return (string)GetValue(DataProperty); }
62 | private set { SetValue(DataProperty, value); }
63 | }
64 | #else
65 | private static readonly DependencyPropertyKey DataPropertyKey
66 | = DependencyProperty.RegisterReadOnly(nameof(Data), typeof(string), typeof(PackIconBase), new PropertyMetadata(""));
67 |
68 | // ReSharper disable once StaticMemberInGenericType
69 | public static readonly DependencyProperty DataProperty = DataPropertyKey.DependencyProperty;
70 |
71 | ///
72 | /// Gets the icon path data for the current .
73 | ///
74 | [TypeConverter(typeof(GeometryConverter))]
75 | public string Data
76 | {
77 | get => (string)GetValue(DataProperty);
78 | private set => SetValue(DataPropertyKey, value);
79 | }
80 | #endif
81 |
82 | #if NETFX_CORE
83 | protected override void OnApplyTemplate()
84 | #else
85 | public override void OnApplyTemplate()
86 | #endif
87 | {
88 | base.OnApplyTemplate();
89 |
90 | UpdateData();
91 | }
92 |
93 | internal override void UpdateData()
94 | {
95 | string data = null;
96 | if (_dataIndex.Value != null)
97 | _dataIndex.Value.TryGetValue(Kind, out data);
98 | Data = data;
99 | }
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/src/PhotonTheme/Controls/Enums/BindingUpdateTrigger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace PhotonTheme.Controls
6 | {
7 | public enum BindingUpdateTrigger
8 | {
9 | OnPropertyChanged,
10 | LostFocus
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/PhotonTheme/Controls/Enums/VerificationResult.cs:
--------------------------------------------------------------------------------
1 | namespace PhotonTheme.Controls
2 | {
3 | public enum VerificationResult
4 | {
5 | None, Fail, Success
6 | }
7 | }
--------------------------------------------------------------------------------
/src/PhotonTheme/Controls/Extensions/ButtonExtension.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace PhotonTheme.Controls
4 | {
5 | public class ButtonExtension
6 | {
7 | ///
8 | /// Controls the corner radius of the Button
9 | ///
10 | public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.RegisterAttached(
11 | "CornerRadius", typeof(CornerRadius), typeof(ButtonExtension), new PropertyMetadata(new CornerRadius(4.0)));
12 |
13 | ///
14 | /// Controls the left PackIconType and its visibility
15 | ///
16 | public static readonly DependencyProperty LeftIconProperty = DependencyProperty.RegisterAttached(
17 | "LeftIcon", typeof(PackIconKind), typeof(ButtonExtension), new PropertyMetadata(null));
18 |
19 | ///
20 | /// Controls the left PackIconType and its visibility
21 | ///
22 | public static readonly DependencyProperty RightIconProperty = DependencyProperty.RegisterAttached(
23 | "RightIcon", typeof(PackIconKind), typeof(ButtonExtension), new PropertyMetadata(null));
24 |
25 | public static readonly DependencyProperty RightIconVisibilityProperty = DependencyProperty.RegisterAttached(
26 | "RightIconVisibility", typeof(Visibility), typeof(ButtonExtension), new PropertyMetadata(Visibility.Collapsed));
27 |
28 | public static readonly DependencyProperty LeftIconVisibilityProperty = DependencyProperty.RegisterAttached(
29 | "LeftIconVisibility", typeof(Visibility), typeof(ButtonExtension), new PropertyMetadata(Visibility.Collapsed));
30 |
31 | public static void SetCornerRadius(DependencyObject element, CornerRadius value)
32 | {
33 | element.SetValue(CornerRadiusProperty, value);
34 | }
35 |
36 | public static CornerRadius GetCornerRadius(DependencyObject element)
37 | {
38 | return (CornerRadius)element.GetValue(CornerRadiusProperty);
39 | }
40 |
41 | public static void SetLeftIcon(DependencyObject element, PackIconKind value)
42 | {
43 | element.SetValue(CornerRadiusProperty, value);
44 | }
45 |
46 | public static PackIconKind GetLeftIcon(DependencyObject element)
47 | {
48 | return (PackIconKind)element.GetValue(LeftIconProperty);
49 | }
50 |
51 | public static void SetRightIcon(DependencyObject element, PackIconKind value)
52 | {
53 | element.SetValue(CornerRadiusProperty, value);
54 | }
55 |
56 | public static PackIconKind GetRightIcon(DependencyObject element)
57 | {
58 | return (PackIconKind)element.GetValue(RightIconProperty);
59 | }
60 |
61 | public static void SetRightIconVisibility(DependencyObject element, Visibility value)
62 | {
63 | element.SetValue(RightIconVisibilityProperty, value);
64 | }
65 |
66 | public static Visibility GetRightIconVisibility(DependencyObject element)
67 | {
68 | return (Visibility)element.GetValue(RightIconVisibilityProperty);
69 | }
70 |
71 | public static void SetLeftIconVisibility(DependencyObject element, Visibility value)
72 | {
73 | element.SetValue(LeftIconVisibilityProperty, value);
74 | }
75 |
76 | public static Visibility GetLeftIconVisibility(DependencyObject element)
77 | {
78 | return (Visibility)element.GetValue(LeftIconVisibilityProperty);
79 | }
80 | }
81 | }
--------------------------------------------------------------------------------
/src/PhotonTheme/Controls/Extensions/FieldExtension.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace PhotonTheme.Controls
4 | {
5 | public class FieldExtension
6 | {
7 | #region Corner Radius
8 | ///
9 | /// Controls the corner radius of the border container
10 | ///
11 | public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.RegisterAttached(
12 | "CornerRadius", typeof(CornerRadius), typeof(FieldExtension), new PropertyMetadata(new CornerRadius(4.0)));
13 |
14 | public static void SetCornerRadius(DependencyObject element, CornerRadius value)
15 | {
16 | element.SetValue(CornerRadiusProperty, value);
17 | }
18 |
19 | public static CornerRadius GetCornerRadius(DependencyObject element)
20 | {
21 | return (CornerRadius)element.GetValue(CornerRadiusProperty);
22 | }
23 | #endregion
24 |
25 | #region Title
26 |
27 | #endregion
28 |
29 | #region Placeholder
30 |
31 | public static readonly DependencyProperty PlaceholderProperty =
32 | DependencyProperty.RegisterAttached("Placeholder", typeof(string), typeof(FieldExtension), new PropertyMetadata(default(string)));
33 |
34 | public static void SetPlaceholder(DependencyObject element, string value)
35 | {
36 | element.SetValue(PlaceholderProperty, value);
37 | }
38 |
39 | public static string GetPlaceholder(DependencyObject element)
40 | {
41 | return (string)element.GetValue(PlaceholderProperty);
42 | }
43 |
44 | #endregion
45 |
46 | #region IsError
47 |
48 | public static readonly DependencyProperty IsErrorProperty = DependencyProperty.RegisterAttached(
49 | "IsError", typeof(bool), typeof(FieldExtension), new PropertyMetadata(false));
50 |
51 | public static void SetIsError(DependencyObject element, bool value)
52 | {
53 | element.SetValue(IsErrorProperty, value);
54 | }
55 |
56 | public static bool GetIsError(DependencyObject element)
57 | {
58 | return (bool)element.GetValue(IsErrorProperty);
59 | }
60 |
61 | #endregion
62 |
63 | #region IsSuccess
64 |
65 | public static readonly DependencyProperty IsSuccessProperty = DependencyProperty.RegisterAttached(
66 | "IsSuccess", typeof(bool), typeof(FieldExtension), new PropertyMetadata(false));
67 |
68 | public static void SetIsSuccess(DependencyObject element, bool value)
69 | {
70 | element.SetValue(IsSuccessProperty, value);
71 | }
72 |
73 | public static bool GetIsSuccess(DependencyObject element)
74 | {
75 | return (bool)element.GetValue(IsSuccessProperty);
76 | }
77 |
78 | #endregion
79 |
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/src/PhotonTheme/Controls/Extensions/PackIconExtension.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Markup;
3 |
4 | namespace PhotonTheme.Controls
5 | {
6 | [MarkupExtensionReturnType(typeof(PackIcon))]
7 | public class PackIconExtension : MarkupExtension
8 | {
9 | public PackIconExtension()
10 | { }
11 |
12 | public PackIconExtension(PackIconKind kind)
13 | {
14 | Kind = kind;
15 | }
16 |
17 | public PackIconExtension(PackIconKind kind, double size)
18 | {
19 | Kind = kind;
20 | Size = size;
21 | }
22 |
23 | [ConstructorArgument("kind")]
24 | public PackIconKind Kind { get; set; }
25 |
26 | [ConstructorArgument("size")]
27 | public double? Size { get; set; }
28 |
29 | public override object ProvideValue(IServiceProvider serviceProvider)
30 | {
31 | var result = new PackIcon { Kind = Kind };
32 |
33 | if (Size.HasValue)
34 | {
35 | result.Height = Size.Value;
36 | result.Width = Size.Value;
37 | }
38 |
39 | return result;
40 | }
41 | }
42 | }
--------------------------------------------------------------------------------
/src/PhotonTheme/Controls/Extensions/ScrollBarExtension.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace PhotonTheme.Controls
4 | {
5 | public class ScrollBarExtension
6 | {
7 | public static readonly DependencyProperty ArrowsVisibilityProperty =
8 | DependencyProperty.RegisterAttached("ArrowsVisibility", typeof(Visibility), typeof(ScrollBarExtension), new PropertyMetadata(Visibility.Visible));
9 |
10 | public static void SetArrowsVisibility(DependencyObject element, Visibility value)
11 | {
12 | element.SetValue(ArrowsVisibilityProperty, value);
13 | }
14 |
15 | public static Visibility GetArrowsVisibility(DependencyObject element)
16 | {
17 | return (Visibility)element.GetValue(ArrowsVisibilityProperty);
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/PhotonTheme/Controls/Extensions/ShadowExtension.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using System.Windows.Media;
4 | using System.Windows.Media.Animation;
5 | using System.Windows.Media.Effects;
6 |
7 | namespace PhotonTheme.Controls
8 | {
9 | public enum ShadowDepth
10 | {
11 | Depth0,
12 | Depth1,
13 | Depth2,
14 | Depth3,
15 | Depth4,
16 | Depth5
17 | }
18 |
19 | [Flags]
20 | public enum ShadowEdges
21 | {
22 | None = 0,
23 | Left = 1,
24 | Top = 2,
25 | Right = 4,
26 | Bottom = 8,
27 | All = Left | Top | Right | Bottom
28 | }
29 |
30 | internal class ShadowLocalInfo
31 | {
32 | public ShadowLocalInfo(double standardOpacity)
33 | {
34 | StandardOpacity = standardOpacity;
35 | }
36 |
37 | public double StandardOpacity { get; }
38 | }
39 |
40 | public static class ShadowExtension
41 | {
42 | public static readonly DependencyProperty ShadowDepthProperty = DependencyProperty.RegisterAttached(
43 | "ShadowDepth", typeof(ShadowDepth), typeof(ShadowExtension), new FrameworkPropertyMetadata(default(ShadowDepth), FrameworkPropertyMetadataOptions.AffectsRender));
44 |
45 | public static void SetShadowDepth(DependencyObject element, ShadowDepth value)
46 | {
47 | element.SetValue(ShadowDepthProperty, value);
48 | }
49 |
50 | public static ShadowDepth GetShadowDepth(DependencyObject element)
51 | {
52 | return (ShadowDepth)element.GetValue(ShadowDepthProperty);
53 | }
54 |
55 | private static readonly DependencyPropertyKey LocalInfoPropertyKey = DependencyProperty.RegisterAttachedReadOnly(
56 | "LocalInfo", typeof(ShadowLocalInfo), typeof(ShadowExtension), new PropertyMetadata(default(ShadowLocalInfo)));
57 |
58 | private static void SetLocalInfo(DependencyObject element, ShadowLocalInfo value)
59 | {
60 | element.SetValue(LocalInfoPropertyKey, value);
61 | }
62 |
63 | private static ShadowLocalInfo GetLocalInfo(DependencyObject element)
64 | {
65 | return (ShadowLocalInfo)element.GetValue(LocalInfoPropertyKey.DependencyProperty);
66 | }
67 |
68 | public static readonly DependencyProperty DarkenProperty = DependencyProperty.RegisterAttached(
69 | "Darken", typeof(bool), typeof(ShadowExtension), new FrameworkPropertyMetadata(default(bool), FrameworkPropertyMetadataOptions.AffectsRender, DarkenPropertyChangedCallback));
70 |
71 | private static void DarkenPropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
72 | {
73 | var uiElement = dependencyObject as UIElement;
74 | var dropShadowEffect = uiElement?.Effect as DropShadowEffect;
75 |
76 | if (dropShadowEffect == null) return;
77 |
78 | if ((bool)dependencyPropertyChangedEventArgs.NewValue)
79 | {
80 | SetLocalInfo(dependencyObject, new ShadowLocalInfo(dropShadowEffect.Opacity));
81 |
82 | var doubleAnimation = new DoubleAnimation(1, new Duration(TimeSpan.FromMilliseconds(350)))
83 | {
84 | FillBehavior = FillBehavior.HoldEnd
85 | };
86 | dropShadowEffect.BeginAnimation(DropShadowEffect.OpacityProperty, doubleAnimation);
87 | }
88 | else
89 | {
90 | var shadowLocalInfo = GetLocalInfo(dependencyObject);
91 | if (shadowLocalInfo == null) return;
92 |
93 | var doubleAnimation = new DoubleAnimation(shadowLocalInfo.StandardOpacity, new Duration(TimeSpan.FromMilliseconds(350)))
94 | {
95 | FillBehavior = FillBehavior.HoldEnd
96 | };
97 | dropShadowEffect.BeginAnimation(DropShadowEffect.OpacityProperty, doubleAnimation);
98 | }
99 | }
100 |
101 | public static void SetDarken(DependencyObject element, bool value)
102 | {
103 | element.SetValue(DarkenProperty, value);
104 | }
105 |
106 | public static bool GetDarken(DependencyObject element)
107 | {
108 | return (bool)element.GetValue(DarkenProperty);
109 | }
110 |
111 | public static readonly DependencyProperty CacheModeProperty = DependencyProperty.RegisterAttached(
112 | "CacheMode", typeof(CacheMode), typeof(ShadowExtension), new FrameworkPropertyMetadata(new BitmapCache { EnableClearType = true, SnapsToDevicePixels = true }, FrameworkPropertyMetadataOptions.Inherits));
113 |
114 | public static void SetCacheMode(DependencyObject element, CacheMode value)
115 | {
116 | element.SetValue(CacheModeProperty, value);
117 | }
118 |
119 | public static CacheMode GetCacheMode(DependencyObject element)
120 | {
121 | return (CacheMode)element.GetValue(CacheModeProperty);
122 | }
123 |
124 | public static readonly DependencyProperty ShadowEdgesProperty = DependencyProperty.RegisterAttached(
125 | "ShadowEdges", typeof(ShadowEdges), typeof(ShadowExtension), new PropertyMetadata(ShadowEdges.All));
126 |
127 | public static void SetShadowEdges(DependencyObject element, ShadowEdges value)
128 | {
129 | element.SetValue(ShadowEdgesProperty, value);
130 | }
131 |
132 | public static ShadowEdges GetShadowEdges(DependencyObject element)
133 | {
134 | return (ShadowEdges)element.GetValue(ShadowEdgesProperty);
135 | }
136 | }
137 | }
--------------------------------------------------------------------------------
/src/PhotonTheme/Controls/Interfaces/IVerificationField.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace PhotonTheme.Controls
4 | {
5 | public interface IVerificationField
6 | {
7 | bool IsError { get; set; }
8 |
9 | bool IsSuccess { get; set; }
10 |
11 | Func VerificationFunction { get; set; }
12 |
13 | bool Verify();
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/PhotonTheme/Controls/PackIcon/PackIcon.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace PhotonTheme.Controls
4 | {
5 | ///
6 | /// Icon from the Material Design Icons project, .
7 | ///
8 | public class PackIcon : PackIconBase
9 | {
10 | static PackIcon()
11 | {
12 | DefaultStyleKeyProperty.OverrideMetadata(typeof(PackIcon), new FrameworkPropertyMetadata(typeof(PackIcon)));
13 | }
14 |
15 | public PackIcon() : base(PackIconDataFactory.Create) { }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/PhotonTheme/Controls/VerificationBox.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using System.Windows.Controls;
4 | using System.Windows.Input;
5 |
6 | namespace PhotonTheme.Controls
7 | {
8 | public sealed class VerificationBox : TextBox, IVerificationField
9 | {
10 |
11 | protected override void OnTextChanged(TextChangedEventArgs e)
12 | {
13 | base.OnTextChanged(e);
14 | if (VerificationFunction != null && VerificationTrigger == BindingUpdateTrigger.OnPropertyChanged)
15 | {
16 | Verify();
17 | }
18 | }
19 |
20 | protected override void OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e)
21 | {
22 | base.OnLostKeyboardFocus(e);
23 | if (VerificationFunction != null && VerificationTrigger == BindingUpdateTrigger.LostFocus)
24 | {
25 | Verify();
26 | }
27 | }
28 |
29 | #region IsError
30 |
31 | public bool IsError
32 | {
33 | get => (bool)GetValue(IsErrorProperty);
34 | set => SetValue(IsErrorProperty, value);
35 | }
36 |
37 | public static readonly DependencyProperty IsErrorProperty =
38 | DependencyProperty.Register(nameof(IsError), typeof(bool), typeof(VerificationBox), new PropertyMetadata(false));
39 |
40 | #endregion
41 |
42 | #region IsSuccess
43 |
44 | public bool IsSuccess
45 | {
46 | get => (bool)GetValue(IsSuccessProperty);
47 | set => SetValue(IsSuccessProperty, value);
48 | }
49 |
50 | public static readonly DependencyProperty IsSuccessProperty =
51 | DependencyProperty.Register(nameof(IsSuccess), typeof(bool), typeof(VerificationBox), new PropertyMetadata(false));
52 |
53 | #endregion
54 |
55 | #region VerificationTrigger
56 |
57 | public BindingUpdateTrigger VerificationTrigger
58 | {
59 | get => (BindingUpdateTrigger)GetValue(VerificationTriggerProperty);
60 | set => SetValue(VerificationTriggerProperty, value);
61 | }
62 |
63 | public static readonly DependencyProperty VerificationTriggerProperty =
64 | DependencyProperty.Register(nameof(VerificationTrigger), typeof(BindingUpdateTrigger), typeof(VerificationBox), new PropertyMetadata(BindingUpdateTrigger.OnPropertyChanged));
65 |
66 | #endregion
67 |
68 | #region Verify
69 |
70 | public Func VerificationFunction { get; set; }
71 |
72 | public bool Verify()
73 | {
74 | var result = VerificationFunction?.Invoke(Text) ?? VerificationResult.None;
75 | switch (result)
76 | {
77 | case VerificationResult.None:
78 | IsError = false;
79 | IsSuccess = false;
80 | return false;
81 | case VerificationResult.Fail:
82 | IsError = true;
83 | IsSuccess = false;
84 | return true;
85 | case VerificationResult.Success:
86 | IsError = false;
87 | IsSuccess = true;
88 | return true;
89 | }
90 | return false;
91 | }
92 |
93 | #endregion
94 |
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/src/PhotonTheme/PhotonTheme.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Library
5 | netcoreapp3.0
6 | true
7 |
8 |
9 | PhotonTheme
10 | 0.0.1
11 | Albert Alonso
12 | Photon Theme
13 | A new clean and modern theme to use in your WPF applications. It also includes new controls missing from the default WPF toolkit.
14 | MIT License
15 | MIT
16 | https://github.com/AlbertAlonso/PhotonTheme
17 | https://github.com/AlbertAlonso/PhotonTheme
18 | WPF Theme
19 | WPF, UI, Theme, XAML, Design, Photon
20 | false
21 | true
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 |
62 |
63 |
64 |
65 | Designer
66 |
67 |
68 | Designer
69 |
70 |
71 | Designer
72 |
73 |
74 | Designer
75 |
76 |
77 | Designer
78 |
79 |
80 | Designer
81 |
82 |
83 | Designer
84 |
85 |
86 | Designer
87 |
88 |
89 | Designer
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/src/PhotonTheme/PhotonTheme.csproj.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | True
3 | True
4 | True
5 | True
6 | True
7 | True
8 | True
9 | True
--------------------------------------------------------------------------------
/src/PhotonTheme/Themes/Base/ButtonBase.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
101 |
102 |
--------------------------------------------------------------------------------
/src/PhotonTheme/Themes/Base/CheckBoxBase.xaml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
76 |
--------------------------------------------------------------------------------
/src/PhotonTheme/Themes/Base/ScrollBarBase.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
41 |
42 |
55 |
56 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
89 |
108 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
133 |
152 |
159 |
160 |
161 |
162 |
178 |
179 |
--------------------------------------------------------------------------------
/src/PhotonTheme/Themes/Base/TabControlBase.xaml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
55 |
56 |
102 |
103 |
149 |
150 |
196 |
197 |
218 |
219 |
--------------------------------------------------------------------------------
/src/PhotonTheme/Themes/Base/TextBlockBase.xaml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
--------------------------------------------------------------------------------
/src/PhotonTheme/Themes/Base/TextBoxBase.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
87 |
--------------------------------------------------------------------------------
/src/PhotonTheme/Themes/Base/VerificationBoxBase.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
106 |
107 |
--------------------------------------------------------------------------------
/src/PhotonTheme/Themes/Defaults.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/PhotonTheme/Themes/General/Colors.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 | #5575C8
7 | #63CE63
8 | #FFBF2F
9 | #E52B20
10 | #353C42
11 | #CCCED0
12 | #ECECEE
13 | #F9F9FB
14 |
15 | #353C42
16 | #F9F9FB
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/src/PhotonTheme/Themes/General/Fonts.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 | ../../Utilities/Resources/Lato/#Lato
7 |
8 | 44
9 | 36
10 | 30
11 | 22
12 | 26
13 | 22
14 | 15
15 | 12
16 |
--------------------------------------------------------------------------------
/src/PhotonTheme/Themes/General/Shadows.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 | #AA000000
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/PhotonTheme/Themes/Generic.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
18 |
19 |
43 |
--------------------------------------------------------------------------------
/src/PhotonTheme/Themes/Styles/Button.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
20 |
21 |
22 |
29 |
30 |
31 |
38 |
39 |
40 |
47 |
48 |
49 |
56 |
57 |
58 |
65 |
66 |
67 |
74 |
75 |
76 |
83 |
84 |
85 |
92 |
93 |
94 |
101 |
102 |
103 |
110 |
111 |
112 |
119 |
120 |
121 |
128 |
129 |
130 |
137 |
138 |
139 |
146 |
147 |
148 |
155 |
156 |
157 |
164 |
165 |
166 |
173 |
174 |
175 |
182 |
183 |
184 |
191 |
--------------------------------------------------------------------------------
/src/PhotonTheme/Themes/Styles/CheckBox.xaml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/PhotonTheme/Themes/Styles/ScrollBar.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
15 |
16 |
17 |
18 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/src/PhotonTheme/Themes/Styles/TabControl.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/PhotonTheme/Themes/Styles/TextBlock.xaml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
16 |
17 |
18 |
19 |
26 |
27 |
28 |
29 |
36 |
37 |
38 |
39 |
46 |
47 |
48 |
49 |
56 |
57 |
58 |
59 |
66 |
67 |
68 |
69 |
76 |
77 |
78 |
79 |
87 |
88 |
89 |
90 |
97 |
98 |
99 |
100 |
107 |
108 |
109 |
110 |
117 |
118 |
119 |
--------------------------------------------------------------------------------
/src/PhotonTheme/Themes/Styles/TextBox.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/src/PhotonTheme/Themes/Styles/VerificationBox.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/PhotonTheme/Utilities/Converters/NullToVisibilityConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows;
4 | using System.Windows.Data;
5 | using System.Windows.Markup;
6 |
7 | namespace PhotonTheme.Utilities.Converters
8 | {
9 | public class NullableToVisibilityConverter : MarkupExtension, IValueConverter
10 | {
11 | public Visibility NullValue { get; set; } = Visibility.Collapsed;
12 | public Visibility NotNullValue { get; set; } = Visibility.Visible;
13 |
14 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
15 | {
16 | return value == null ? NullValue : NotNullValue;
17 | }
18 |
19 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
20 | {
21 | return Binding.DoNothing;
22 | }
23 |
24 | public override object ProvideValue(IServiceProvider serviceProvider)
25 | {
26 | return this;
27 | }
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/src/PhotonTheme/Utilities/Converters/ShadowConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows.Data;
4 | using System.Windows.Media.Effects;
5 | using PhotonTheme.Controls;
6 |
7 | namespace PhotonTheme.Utilities.Converters
8 | {
9 | public class ShadowConverter : IValueConverter
10 | {
11 | public static readonly ShadowConverter Instance = new ShadowConverter();
12 |
13 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
14 | {
15 | if (!(value is ShadowDepth)) return null;
16 |
17 | return Clone(Convert((ShadowDepth)value));
18 | }
19 |
20 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
21 | {
22 | throw new NotImplementedException();
23 | }
24 |
25 | public static DropShadowEffect Convert(ShadowDepth shadowDepth)
26 | {
27 | return ShadowInfo.GetDropShadow(shadowDepth);
28 | }
29 |
30 | private static DropShadowEffect Clone(DropShadowEffect dropShadowEffect)
31 | {
32 | if (dropShadowEffect == null) return null;
33 | return new DropShadowEffect()
34 | {
35 | BlurRadius = dropShadowEffect.BlurRadius,
36 | Color = dropShadowEffect.Color,
37 | Direction = dropShadowEffect.Direction,
38 | Opacity = dropShadowEffect.Opacity,
39 | RenderingBias = dropShadowEffect.RenderingBias,
40 | ShadowDepth = dropShadowEffect.ShadowDepth
41 | };
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/PhotonTheme/Utilities/Converters/ShadowInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Windows;
4 | using System.Windows.Media.Effects;
5 | using PhotonTheme.Controls;
6 |
7 | namespace PhotonTheme.Utilities.Converters
8 | {
9 | internal static class ShadowInfo
10 | {
11 | private static readonly IDictionary ShadowsDictionary;
12 |
13 | static ShadowInfo()
14 | {
15 | var resourceDictionary = new ResourceDictionary { Source = new Uri("pack://application:,,,/PhotonTheme;component/Themes/General/Shadows.xaml", UriKind.Absolute) };
16 |
17 | ShadowsDictionary = new Dictionary
18 | {
19 | { ShadowDepth.Depth0, null },
20 | { ShadowDepth.Depth1, (DropShadowEffect)resourceDictionary["ShadowDepth1"] },
21 | { ShadowDepth.Depth2, (DropShadowEffect)resourceDictionary["ShadowDepth2"] },
22 | { ShadowDepth.Depth3, (DropShadowEffect)resourceDictionary["ShadowDepth3"] },
23 | { ShadowDepth.Depth4, (DropShadowEffect)resourceDictionary["ShadowDepth4"] },
24 | { ShadowDepth.Depth5, (DropShadowEffect)resourceDictionary["ShadowDepth5"] },
25 | };
26 | }
27 |
28 | public static DropShadowEffect GetDropShadow(ShadowDepth depth)
29 | {
30 | return ShadowsDictionary[depth];
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/src/PhotonTheme/Utilities/Converters/StringToVisibility.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows;
4 | using System.Windows.Data;
5 | using System.Windows.Markup;
6 |
7 | namespace PhotonTheme.Utilities.Converters
8 | {
9 | public class StringToVisibility : MarkupExtension, IValueConverter
10 | {
11 | public bool Inverted { private get; set; }
12 |
13 | public override object ProvideValue(IServiceProvider serviceProvider) => this;
14 |
15 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
16 | {
17 | if (Inverted)
18 | {
19 | return string.IsNullOrEmpty((string)value) ? Visibility.Visible : Visibility.Collapsed;
20 | }
21 |
22 | return string.IsNullOrEmpty((string)value) ? Visibility.Collapsed : Visibility.Visible;
23 |
24 | }
25 |
26 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
27 | {
28 | return Binding.DoNothing;
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/src/PhotonTheme/Utilities/Resources/Lato/Lato-Black.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alonfnt/PhotonTheme/58b3dc41b96f42718567d22ceebf757a36a04b5d/src/PhotonTheme/Utilities/Resources/Lato/Lato-Black.ttf
--------------------------------------------------------------------------------
/src/PhotonTheme/Utilities/Resources/Lato/Lato-BlackItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alonfnt/PhotonTheme/58b3dc41b96f42718567d22ceebf757a36a04b5d/src/PhotonTheme/Utilities/Resources/Lato/Lato-BlackItalic.ttf
--------------------------------------------------------------------------------
/src/PhotonTheme/Utilities/Resources/Lato/Lato-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alonfnt/PhotonTheme/58b3dc41b96f42718567d22ceebf757a36a04b5d/src/PhotonTheme/Utilities/Resources/Lato/Lato-Bold.ttf
--------------------------------------------------------------------------------
/src/PhotonTheme/Utilities/Resources/Lato/Lato-BoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alonfnt/PhotonTheme/58b3dc41b96f42718567d22ceebf757a36a04b5d/src/PhotonTheme/Utilities/Resources/Lato/Lato-BoldItalic.ttf
--------------------------------------------------------------------------------
/src/PhotonTheme/Utilities/Resources/Lato/Lato-Hairline.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alonfnt/PhotonTheme/58b3dc41b96f42718567d22ceebf757a36a04b5d/src/PhotonTheme/Utilities/Resources/Lato/Lato-Hairline.ttf
--------------------------------------------------------------------------------
/src/PhotonTheme/Utilities/Resources/Lato/Lato-HairlineItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alonfnt/PhotonTheme/58b3dc41b96f42718567d22ceebf757a36a04b5d/src/PhotonTheme/Utilities/Resources/Lato/Lato-HairlineItalic.ttf
--------------------------------------------------------------------------------
/src/PhotonTheme/Utilities/Resources/Lato/Lato-Italic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alonfnt/PhotonTheme/58b3dc41b96f42718567d22ceebf757a36a04b5d/src/PhotonTheme/Utilities/Resources/Lato/Lato-Italic.ttf
--------------------------------------------------------------------------------
/src/PhotonTheme/Utilities/Resources/Lato/Lato-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alonfnt/PhotonTheme/58b3dc41b96f42718567d22ceebf757a36a04b5d/src/PhotonTheme/Utilities/Resources/Lato/Lato-Light.ttf
--------------------------------------------------------------------------------
/src/PhotonTheme/Utilities/Resources/Lato/Lato-LightItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alonfnt/PhotonTheme/58b3dc41b96f42718567d22ceebf757a36a04b5d/src/PhotonTheme/Utilities/Resources/Lato/Lato-LightItalic.ttf
--------------------------------------------------------------------------------
/src/PhotonTheme/Utilities/Resources/Lato/Lato-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alonfnt/PhotonTheme/58b3dc41b96f42718567d22ceebf757a36a04b5d/src/PhotonTheme/Utilities/Resources/Lato/Lato-Regular.ttf
--------------------------------------------------------------------------------
/src/PhotonTheme/Utilities/Resources/Lato/OFL.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2010-2014 by tyPoland Lukasz Dziedzic (team@latofonts.com) with Reserved Font Name "Lato"
2 |
3 | This Font Software is licensed under the SIL Open Font License, Version 1.1.
4 | This license is copied below, and is also available with a FAQ at:
5 | http://scripts.sil.org/OFL
6 |
7 |
8 | -----------------------------------------------------------
9 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10 | -----------------------------------------------------------
11 |
12 | PREAMBLE
13 | The goals of the Open Font License (OFL) are to stimulate worldwide
14 | development of collaborative font projects, to support the font creation
15 | efforts of academic and linguistic communities, and to provide a free and
16 | open framework in which fonts may be shared and improved in partnership
17 | with others.
18 |
19 | The OFL allows the licensed fonts to be used, studied, modified and
20 | redistributed freely as long as they are not sold by themselves. The
21 | fonts, including any derivative works, can be bundled, embedded,
22 | redistributed and/or sold with any software provided that any reserved
23 | names are not used by derivative works. The fonts and derivatives,
24 | however, cannot be released under any other type of license. The
25 | requirement for fonts to remain under this license does not apply
26 | to any document created using the fonts or their derivatives.
27 |
28 | DEFINITIONS
29 | "Font Software" refers to the set of files released by the Copyright
30 | Holder(s) under this license and clearly marked as such. This may
31 | include source files, build scripts and documentation.
32 |
33 | "Reserved Font Name" refers to any names specified as such after the
34 | copyright statement(s).
35 |
36 | "Original Version" refers to the collection of Font Software components as
37 | distributed by the Copyright Holder(s).
38 |
39 | "Modified Version" refers to any derivative made by adding to, deleting,
40 | or substituting -- in part or in whole -- any of the components of the
41 | Original Version, by changing formats or by porting the Font Software to a
42 | new environment.
43 |
44 | "Author" refers to any designer, engineer, programmer, technical
45 | writer or other person who contributed to the Font Software.
46 |
47 | PERMISSION & CONDITIONS
48 | Permission is hereby granted, free of charge, to any person obtaining
49 | a copy of the Font Software, to use, study, copy, merge, embed, modify,
50 | redistribute, and sell modified and unmodified copies of the Font
51 | Software, subject to the following conditions:
52 |
53 | 1) Neither the Font Software nor any of its individual components,
54 | in Original or Modified Versions, may be sold by itself.
55 |
56 | 2) Original or Modified Versions of the Font Software may be bundled,
57 | redistributed and/or sold with any software, provided that each copy
58 | contains the above copyright notice and this license. These can be
59 | included either as stand-alone text files, human-readable headers or
60 | in the appropriate machine-readable metadata fields within text or
61 | binary files as long as those fields can be easily viewed by the user.
62 |
63 | 3) No Modified Version of the Font Software may use the Reserved Font
64 | Name(s) unless explicit written permission is granted by the corresponding
65 | Copyright Holder. This restriction only applies to the primary font name as
66 | presented to the users.
67 |
68 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69 | Software shall not be used to promote, endorse or advertise any
70 | Modified Version, except to acknowledge the contribution(s) of the
71 | Copyright Holder(s) and the Author(s) or with their explicit written
72 | permission.
73 |
74 | 5) The Font Software, modified or unmodified, in part or in whole,
75 | must be distributed entirely under this license, and must not be
76 | distributed under any other license. The requirement for fonts to
77 | remain under this license does not apply to any document created
78 | using the Font Software.
79 |
80 | TERMINATION
81 | This license becomes null and void if any of the above conditions are
82 | not met.
83 |
84 | DISCLAIMER
85 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93 | OTHER DEALINGS IN THE FONT SOFTWARE.
94 |
--------------------------------------------------------------------------------