├── .gitignore
├── LICENSE
├── README.md
└── src
├── LanguageApp
├── LanguageApp.sln
└── LanguageApp
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── AssemblyInfo.cs
│ ├── LanguageApp.csproj
│ ├── LanguageModel.cs
│ ├── MainViewModel.cs
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ ├── TeamModel.cs
│ ├── ThemeModel.cs
│ └── Themes
│ ├── Chinese.xaml
│ ├── Dark.xaml
│ ├── English.xaml
│ ├── Korean.xaml
│ └── White.xaml
├── WpfApp
├── WpfApp.sln
└── WpfApp
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── AssemblyInfo.cs
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ └── WpfApp.csproj
├── WpfBtApp
├── WpfBtApp.sln
└── WpfBtApp
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── AssemblyInfo.cs
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ └── WpfBtApp.csproj
├── WpfPracticeApp
├── WpfCustomApp
│ ├── App.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Starter.cs
│ ├── Themes
│ │ ├── Generic.xaml
│ │ └── Units
│ │ │ ├── StudyButton.xaml
│ │ │ ├── StudyListBox.xaml
│ │ │ └── StudyListBoxItem.xaml
│ ├── UI
│ │ ├── Units
│ │ │ ├── StudyButton.cs
│ │ │ ├── StudyListBox.cs
│ │ │ └── StudyListBoxItem.cs
│ │ └── Views
│ │ │ ├── PracticeWindow.xaml
│ │ │ ├── PracticeWindow.xaml.cs
│ │ │ └── User.cs
│ └── WpfCustomApp.csproj
├── WpfPracticeApp.sln
└── WpfPracticeApp
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── AssemblyInfo.cs
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ ├── Resources
│ └── ListBoxStyles.xaml
│ ├── User.cs
│ └── WpfPracticeApp.csproj
└── wpfexplorer
└── WpfExplorer
├── WpfExplorer.Forms
├── AssemblyInfo.cs
├── Local
│ └── ViewModels
│ │ └── ExplorerViewModel.cs
├── Themes
│ ├── Generic.xaml
│ └── Views
│ │ └── ExplorerWindow.xaml
├── UI
│ └── Views
│ │ └── ExplorerWindow.cs
└── WpfExplorer.Forms.csproj
├── WpfExplorer.Location
├── Local
│ └── ViewModels
│ │ └── LocationContentViewModel.cs
├── Properties
│ └── AssemblyInfo.cs
├── Themes
│ ├── Generic.xaml
│ └── Views
│ │ └── LocationContent.xaml
├── UI
│ └── Views
│ │ └── LocationContent.cs
└── WpfExplorer.Location.csproj
├── WpfExplorer.Main
├── AssemblyInfo.cs
├── Local
│ └── ViewModels
│ │ └── MainContentViewModel.cs
├── Themes
│ ├── Generic.xaml
│ ├── Units
│ │ ├── ExpandButton.xaml
│ │ ├── FolderTreeItem.xaml
│ │ └── FolderTreeView.xaml
│ └── Views
│ │ └── MainContent.xaml
├── UI
│ ├── Units
│ │ ├── ExpandButton.cs
│ │ ├── FolderTreeItem.cs
│ │ └── FolderTreeView.cs
│ └── Views
│ │ └── MainContent.cs
└── WpfExplorer.Main.csproj
├── WpfExplorer.Support
├── Local
│ ├── Converters
│ │ └── DepthConverter.cs
│ ├── Helpers
│ │ ├── DirectoryManager.cs
│ │ ├── FileService.cs
│ │ └── NavigatorService.cs
│ └── Models
│ │ ├── FileInfoBase.cs
│ │ ├── FolderInfo.cs
│ │ ├── LocationChangedEventArgs.cs
│ │ └── Memento.cs
├── Properties
│ └── AssemblyInfo.cs
├── Themes
│ ├── Generic.xaml
│ └── Units
│ │ ├── CloseButton.xaml
│ │ ├── DarkWindow.xaml
│ │ ├── MaximizeButton.xaml
│ │ └── MinimizeButton.xaml
├── UI
│ └── Units
│ │ ├── CloseButton.cs
│ │ ├── DarkWindow.cs
│ │ ├── MaximizeButton.cs
│ │ └── MinimizeButton.cs
└── WpfExplorer.Support.csproj
├── WpfExplorer.sln
└── WpfExplorer
├── App.cs
├── Properties
├── HelperModules.cs
├── ViewModules.cs
└── WireDataContext.cs
├── Starter.cs
└── WpfExplorer.csproj
/.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/main/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 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Ww][Ii][Nn]32/
27 | [Aa][Rr][Mm]/
28 | [Aa][Rr][Mm]64/
29 | bld/
30 | [Bb]in/
31 | [Oo]bj/
32 | [Ll]og/
33 | [Ll]ogs/
34 |
35 | # Visual Studio 2015/2017 cache/options directory
36 | .vs/
37 | # Uncomment if you have tasks that create the project's static files in wwwroot
38 | #wwwroot/
39 |
40 | # Visual Studio 2017 auto generated files
41 | Generated\ Files/
42 |
43 | # MSTest test Results
44 | [Tt]est[Rr]esult*/
45 | [Bb]uild[Ll]og.*
46 |
47 | # NUnit
48 | *.VisualState.xml
49 | TestResult.xml
50 | nunit-*.xml
51 |
52 | # Build Results of an ATL Project
53 | [Dd]ebugPS/
54 | [Rr]eleasePS/
55 | dlldata.c
56 |
57 | # Benchmark Results
58 | BenchmarkDotNet.Artifacts/
59 |
60 | # .NET Core
61 | project.lock.json
62 | project.fragment.lock.json
63 | artifacts/
64 |
65 | # ASP.NET Scaffolding
66 | ScaffoldingReadMe.txt
67 |
68 | # StyleCop
69 | StyleCopReport.xml
70 |
71 | # Files built by Visual Studio
72 | *_i.c
73 | *_p.c
74 | *_h.h
75 | *.ilk
76 | *.meta
77 | *.obj
78 | *.iobj
79 | *.pch
80 | *.pdb
81 | *.ipdb
82 | *.pgc
83 | *.pgd
84 | *.rsp
85 | *.sbr
86 | *.tlb
87 | *.tli
88 | *.tlh
89 | *.tmp
90 | *.tmp_proj
91 | *_wpftmp.csproj
92 | *.log
93 | *.tlog
94 | *.vspscc
95 | *.vssscc
96 | .builds
97 | *.pidb
98 | *.svclog
99 | *.scc
100 |
101 | # Chutzpah Test files
102 | _Chutzpah*
103 |
104 | # Visual C++ cache files
105 | ipch/
106 | *.aps
107 | *.ncb
108 | *.opendb
109 | *.opensdf
110 | *.sdf
111 | *.cachefile
112 | *.VC.db
113 | *.VC.VC.opendb
114 |
115 | # Visual Studio profiler
116 | *.psess
117 | *.vsp
118 | *.vspx
119 | *.sap
120 |
121 | # Visual Studio Trace Files
122 | *.e2e
123 |
124 | # TFS 2012 Local Workspace
125 | $tf/
126 |
127 | # Guidance Automation Toolkit
128 | *.gpState
129 |
130 | # ReSharper is a .NET coding add-in
131 | _ReSharper*/
132 | *.[Rr]e[Ss]harper
133 | *.DotSettings.user
134 |
135 | # TeamCity is a build add-in
136 | _TeamCity*
137 |
138 | # DotCover is a Code Coverage Tool
139 | *.dotCover
140 |
141 | # AxoCover is a Code Coverage Tool
142 | .axoCover/*
143 | !.axoCover/settings.json
144 |
145 | # Coverlet is a free, cross platform Code Coverage Tool
146 | coverage*.json
147 | coverage*.xml
148 | coverage*.info
149 |
150 | # Visual Studio code coverage results
151 | *.coverage
152 | *.coveragexml
153 |
154 | # NCrunch
155 | _NCrunch_*
156 | .*crunch*.local.xml
157 | nCrunchTemp_*
158 |
159 | # MightyMoose
160 | *.mm.*
161 | AutoTest.Net/
162 |
163 | # Web workbench (sass)
164 | .sass-cache/
165 |
166 | # Installshield output folder
167 | [Ee]xpress/
168 |
169 | # DocProject is a documentation generator add-in
170 | DocProject/buildhelp/
171 | DocProject/Help/*.HxT
172 | DocProject/Help/*.HxC
173 | DocProject/Help/*.hhc
174 | DocProject/Help/*.hhk
175 | DocProject/Help/*.hhp
176 | DocProject/Help/Html2
177 | DocProject/Help/html
178 |
179 | # Click-Once directory
180 | publish/
181 |
182 | # Publish Web Output
183 | *.[Pp]ublish.xml
184 | *.azurePubxml
185 | # Note: Comment the next line if you want to checkin your web deploy settings,
186 | # but database connection strings (with potential passwords) will be unencrypted
187 | *.pubxml
188 | *.publishproj
189 |
190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
191 | # checkin your Azure Web App publish settings, but sensitive information contained
192 | # in these scripts will be unencrypted
193 | PublishScripts/
194 |
195 | # NuGet Packages
196 | *.nupkg
197 | # NuGet Symbol Packages
198 | *.snupkg
199 | # The packages folder can be ignored because of Package Restore
200 | **/[Pp]ackages/*
201 | # except build/, which is used as an MSBuild target.
202 | !**/[Pp]ackages/build/
203 | # Uncomment if necessary however generally it will be regenerated when needed
204 | #!**/[Pp]ackages/repositories.config
205 | # NuGet v3's project.json files produces more ignorable files
206 | *.nuget.props
207 | *.nuget.targets
208 |
209 | # Microsoft Azure Build Output
210 | csx/
211 | *.build.csdef
212 |
213 | # Microsoft Azure Emulator
214 | ecf/
215 | rcf/
216 |
217 | # Windows Store app package directories and files
218 | AppPackages/
219 | BundleArtifacts/
220 | Package.StoreAssociation.xml
221 | _pkginfo.txt
222 | *.appx
223 | *.appxbundle
224 | *.appxupload
225 |
226 | # Visual Studio cache files
227 | # files ending in .cache can be ignored
228 | *.[Cc]ache
229 | # but keep track of directories ending in .cache
230 | !?*.[Cc]ache/
231 |
232 | # Others
233 | ClientBin/
234 | ~$*
235 | *~
236 | *.dbmdl
237 | *.dbproj.schemaview
238 | *.jfm
239 | *.pfx
240 | *.publishsettings
241 | orleans.codegen.cs
242 |
243 | # Including strong name files can present a security risk
244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
245 | #*.snk
246 |
247 | # Since there are multiple workflows, uncomment next line to ignore bower_components
248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
249 | #bower_components/
250 |
251 | # RIA/Silverlight projects
252 | Generated_Code/
253 |
254 | # Backup & report files from converting an old project file
255 | # to a newer Visual Studio version. Backup files are not needed,
256 | # because we have git ;-)
257 | _UpgradeReport_Files/
258 | Backup*/
259 | UpgradeLog*.XML
260 | UpgradeLog*.htm
261 | ServiceFabricBackup/
262 | *.rptproj.bak
263 |
264 | # SQL Server files
265 | *.mdf
266 | *.ldf
267 | *.ndf
268 |
269 | # Business Intelligence projects
270 | *.rdl.data
271 | *.bim.layout
272 | *.bim_*.settings
273 | *.rptproj.rsuser
274 | *- [Bb]ackup.rdl
275 | *- [Bb]ackup ([0-9]).rdl
276 | *- [Bb]ackup ([0-9][0-9]).rdl
277 |
278 | # Microsoft Fakes
279 | FakesAssemblies/
280 |
281 | # GhostDoc plugin setting file
282 | *.GhostDoc.xml
283 |
284 | # Node.js Tools for Visual Studio
285 | .ntvs_analysis.dat
286 | node_modules/
287 |
288 | # Visual Studio 6 build log
289 | *.plg
290 |
291 | # Visual Studio 6 workspace options file
292 | *.opt
293 |
294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
295 | *.vbw
296 |
297 | # Visual Studio 6 auto-generated project file (contains which files were open etc.)
298 | *.vbp
299 |
300 | # Visual Studio 6 workspace and project file (working project files containing files to include in project)
301 | *.dsw
302 | *.dsp
303 |
304 | # Visual Studio 6 technical files
305 | *.ncb
306 | *.aps
307 |
308 | # Visual Studio LightSwitch build output
309 | **/*.HTMLClient/GeneratedArtifacts
310 | **/*.DesktopClient/GeneratedArtifacts
311 | **/*.DesktopClient/ModelManifest.xml
312 | **/*.Server/GeneratedArtifacts
313 | **/*.Server/ModelManifest.xml
314 | _Pvt_Extensions
315 |
316 | # Paket dependency manager
317 | .paket/paket.exe
318 | paket-files/
319 |
320 | # FAKE - F# Make
321 | .fake/
322 |
323 | # CodeRush personal settings
324 | .cr/personal
325 |
326 | # Python Tools for Visual Studio (PTVS)
327 | __pycache__/
328 | *.pyc
329 |
330 | # Cake - Uncomment if you are using it
331 | # tools/**
332 | # !tools/packages.config
333 |
334 | # Tabs Studio
335 | *.tss
336 |
337 | # Telerik's JustMock configuration file
338 | *.jmconfig
339 |
340 | # BizTalk build output
341 | *.btp.cs
342 | *.btm.cs
343 | *.odx.cs
344 | *.xsd.cs
345 |
346 | # OpenCover UI analysis results
347 | OpenCover/
348 |
349 | # Azure Stream Analytics local run output
350 | ASALocalRun/
351 |
352 | # MSBuild Binary and Structured Log
353 | *.binlog
354 |
355 | # NVidia Nsight GPU debugger configuration file
356 | *.nvuser
357 |
358 | # MFractors (Xamarin productivity tool) working folder
359 | .mfractor/
360 |
361 | # Local History for Visual Studio
362 | .localhistory/
363 |
364 | # Visual Studio History (VSHistory) files
365 | .vshistory/
366 |
367 | # BeatPulse healthcheck temp database
368 | healthchecksdb
369 |
370 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
371 | MigrationBackup/
372 |
373 | # Ionide (cross platform F# VS Code tools) working folder
374 | .ionide/
375 |
376 | # Fody - auto-generated XML schema
377 | FodyWeavers.xsd
378 |
379 | # VS Code files for those working on multiple tools
380 | .vscode/*
381 | !.vscode/settings.json
382 | !.vscode/tasks.json
383 | !.vscode/launch.json
384 | !.vscode/extensions.json
385 | *.code-workspace
386 |
387 | # Local History for Visual Studio Code
388 | .history/
389 |
390 | # Windows Installer files from build outputs
391 | *.cab
392 | *.msi
393 | *.msix
394 | *.msm
395 | *.msp
396 |
397 | # JetBrains Rider
398 | *.sln.iml
399 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 jamesnet
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 | # WPF Study
2 |
3 | WPF 스터디 시즌 3 문서입니다!
4 |
5 | ---
6 | ### Contributors
7 | Thanks go to these wonderful people (List made with [contrib.rocks](https://contrib.rocks)):
8 |
9 |
10 |
11 |
12 |
13 | ---
14 |
15 | 참고 내용
16 | - [Git](https://blog.naver.com/jamesnet214/222991222558)
17 | - [Markdown](https://blog.naver.com/jamesnet214/222983692433)
18 | - GitHub Profile
19 | - GitHub Wiki
20 | - [Nuget Dark Theme](https://forum.dotnetdev.kr/t/infragistics-theme-metrodark-wpf/4790)
21 | - [ListBox Exam](https://blog.naver.com/jamesnet214/222975314777)
22 | - [AutoGrid.Core](https://blog.naver.com/jamesnet214/222982802666)
23 | - [XAML 코드 자동정렬 도구](https://github.com/Xavalon/XamlStyler/)
24 |
25 | - [MAUI Sample App](https://github.com/jamesnet214/maui-premierleague)
26 | - [LukeWire MAUI Sample App](https://github.com/lukewire129/DotnetMauiSample)
27 | - [MauiReactor Sample App](https://github.com/adospace/mauireactor-samples)
28 |
29 | ## Content
30 |
31 | - [x] 1. [Button](#1-button)
32 | - [x] 2. [ControlTemplate](#2-controltemplate)
33 | - [x] 3. [DataTemplate](#3-datatemplate)
34 | - [x] 4. [Trigger](#4-trigger)
35 | - [x] 5. [ContentControl](#5-contentcontrol)
36 | ------------------------------------------------------
37 | - [ ] 6. [ListBox](#6-listbox)
38 | - [ ] 7. [ListBoxItem](#7-listboxitem)
39 | - [ ] 8. ItemsControl
40 | - [ ] 9. CustomControl
41 | - [ ] 10. GetContainerItemForOverride
42 | - [ ] 11. AutoGrid.Core
43 | - [ ] 12. CommunityToolkit
44 | - [ ] 13. NugetPackage
45 | --------------------------------------------------------
46 | - [ ] 14. Bubbling / Tunneling
47 | - [ ] 15. Languages
48 | - [ ] 16. Themes
49 | - [ ] 17. TreeView / TreeViewItem
50 |
51 | ## 1. Button
52 |
53 | - [ContentControl](#5-contentcontrol)을 상속한다.
54 | - 즉, ```Content``` 프로퍼티를 갖고 있으며 이는 곧 Button의 내용이다.
55 |
56 | ```xml
57 |
58 | ```
59 |
60 | ## 2. ControlTemplate
61 |
62 | - ```Control``` 클래스가 갖고 있는 ```Template``` 프로퍼티의 타입이다.
63 | - ```Control``` 의 ```Template```을 정의(set value)한다는 것은, 해당 ```Control```의 기존 xaml 구성을 모두 지우고 다시 그리겠다는 의미다.
64 | ```xml
65 |
77 | ```
78 | - ```ControlTemplate``` 은 ```TargetType``` 프로퍼티를 갖고 있다.
79 | - ```TargetType``` 으로 새로 그리는 ```Control```의 타입을 알려줘야 해당 ```Control```의 고유 프로퍼티를 호출/연결할 수 있다.
80 | - ```ControlTemplate``` 은 ```Triggers``` 프로퍼티를 갖고 있다.
81 | - ```Triggers```의 타입은 ```TriggerCollection```으로, ```TriggerBase```를 아이템으로 가진다. ([4. Trigger](#4-trigger) 참조)
82 | - ```Trigger``` 를 등록하여 대상 ```Control```의 상태를 감시하고 변경 할 수 있다. ([4. Trigger](#4-trigger) 참조)
83 |
84 | ```xml
85 |
86 |
87 | ...
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 | ```
97 |
98 |
99 | - 대상 ```Control``` 의 프로퍼티와 연결하기 위해 ```TemplateBinding```을 사용한다.
100 |
101 | ```xml
102 |
103 |
104 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 | ```
117 |
118 |
119 | - 내부 Control에 ```Name```을 부여하여 내부에서 직접 접근하는 방법도 있다.
120 |
121 | ```xml
122 |
123 |
124 |
125 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 | ```
140 |
141 | - 대상 ```Control``` 이 ```ContentControl```을 상속하고 있다면, ```ContentPresenter```를 통해 ```ContentTemplate```을 바인딩 할 수 있다.
142 |
143 | ```xml
144 |
145 |
146 |
147 |
152 |
153 |
154 |
157 |
158 |
159 | ```
160 |
161 |
162 | ## 3. DataTemplate
163 |
164 | - ContentControl을 상속 받는 클래스의 ContentTemplate을 재정의 해줌
165 | - `Content`를 재정의하고 있으며, `ContentControl`을 상속 받는 `Window`나 `Button`이나 모두 같은 원리로 동작한다.(ContentControl을 상속 받는 모든 개체)
166 | - `Button`, `ToggleButton`, `CheckBox`, `RadioButton` 등에 모두 같은 `DataTemplate`이 적용된 것을 볼 수 있다.
167 |
168 |
169 | - 실행 화면 (좌측부터 `Button`, `ToggleButton`, `CheckBox`, `RadioButton` - 같은 `DataTemplate`을 사용하고 있다.)
170 |
171 | 
172 |
173 | ```xml
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
190 |
192 |
194 |
196 |
197 | ```
198 |
199 | ## 4. Trigger
200 |
201 | - ```TriggerBase```를 상속한다.
202 | - 조건을 설정하고, 조건 만족시 변경할 상태(or Action)를 정의.
203 | - 조건 불만족 시 이전 상태로 복귀.
204 | - 주요 프로퍼티.
205 |
206 | | Name | Type | Note |
207 | |:-----|:-----|:-----|
208 | | `Property` | `DependencyProperty` | 감시 대상(Control)의 Property(DependencyProperty) |
209 | | `Value` | `object` | 설정한 `Property` 와 비교할 값 |
210 | | `Setters` | `SetterBaseCollection` | Trigger 조건 만족 시 적용할 Setter 목록 (복수 Setter 설정 가능) |
211 |
212 | ```xml
213 |
241 | ```
242 |
243 |
244 | ## 5. ContentControl
245 |
246 | - ```Content``` 프로퍼티를 갖고 있다.
247 | - ```Content``` 타입은 ```object``` 로 다른 Control 을 넣을 수 있다.
248 |
249 | ```xml
250 |
251 |
252 |
253 |
254 |
262 | ```
263 |
264 |
265 | - ```Content``` 로 문자열만 입력된 경우는 내부적으로 ```TextBlock```이 추가됐다고 볼 수 있다.
266 |
267 | ```xml
268 |
269 |
270 |
271 |
272 |
277 |
278 |
279 |
284 | ```
285 |
286 |
287 | - ```ContentTemplate``` 프로퍼티를 갖고 있다.
288 | - ```ContentTemplate``` 타입은 ```DateTemplate``` 으로 Resource에 정의한 DataTemplate을 넣을 수 있다.
289 |
290 | ```xml
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 | ```
303 |
304 |
305 | - Xaml 에서 ```Content``` 태그는 생략 가능하다.
306 |
307 | ```xml
308 |
313 |
314 |
315 |
318 | ```
319 |
320 |
321 | - ```ContentControl``` 클래스를 상속받는 Control 목록 (작성 중...)
322 |
323 | | 클래스 | 부모 클래스 |
324 | |:------|:------------|
325 | | Button | ButtonBase |
326 | | CheckBox | ContentControl |
327 | | RadioButton | ContentControl |
328 | | ToggleButton | ContentControl |
329 | | ListBoxItem | ContentControl |
330 | | Label | ContentControl |
331 | | ComboBoxItem | ContentControl |
332 | | ListViewItem | ContentControl |
333 | | TreeViewItem | ContentControl |
334 | | GroupBox | ContentControl |
335 | | Window | ContentControl |
336 | | UserControl | ContentControl |
337 | | ScrollViewer | ContentControl |
338 |
339 |
340 |
341 | ## 6. ListBox
342 |
343 | - 다음과 같은 상속 관계를 가진다
344 | - `ItemsControl` -> `Selector` -> `ListBox`
345 | - 주요 프로퍼티
346 |
347 | | Name | Type | Content | Note|
348 | |:-----|:-----|:--------|:----|
349 | | `ItemsSource` | `IEnumerable` | `ListBoxItem`을 생성하기 위한 컬렉션 | `ItemsControl`에서 상속됨 |
350 | | `ItemTemplate` | `DataTemplate` | `ListBoxItem`의 ContentTemplate을 재정의하기 위한 DataTemplate | `ItemsControl`에서 상속됨 ([3. DataTemplate](#3-datatemplate) 참조) |
351 | | `ItemContainerStyle` | `Style ` | `ListBoxItem`의 Style | `ItemsControl`에서 상속됨 |
352 | | `DisplayMemberPath` | `string` | `ListBoxItem`의 Content로 표시할 Path 이름. 바인딩 된 아이템 Source 객체의 프로퍼티 중 Content로 표시할 프로퍼티 이름으로 설정한다. | `ItemsControl`에서 상속됨 |
353 | | `SelectedItem` | `object` |
- 선택된 첫번째 아이템
(여러개 선택 시 처음 선택된 아이템 하나만 반환) - 선택된 항목이 없는 경우 null 반환
| `Selector`에서 상속됨 |
354 | | `SelectionMode` | `SelectionMode`(Enum) | `ListBox` 의 선택 동작 정의 | - `Single` : 하나만 선택 가능
- `Multiple` : 한정자 키 누르지 않고 여러개 선택 가능
- `Extended` : Shift 키 누른 상태로 여러개 선택 가능
|
355 |
356 |
357 |
358 | ## 7. ListBoxItem
359 |
360 | - 다음과 같은 상속 관계를 가진다
361 | - [ContentControl](#5-contentcontrol) -> `ListBoxItem`
362 | - [ListBox](#6-listbox) 의 `ItemTemplate`을 설정하여 Content를 재정의할 수 있다.
363 | - [ListBox](#6-listbox) 의 `ItemContainerStyle` 설정하여 Style을 적용할 수 있다.
364 |
365 |
366 | ## 14. Bubbling / Tunneling
367 |
368 | - 이벤트의 순서는 `Tunneling` -> `Bubbling` 순서로 발생한다.
369 |
370 | ### Tunneling
371 |
372 | - `Tunneling` 이벤트는 `UIElement`의 `Preview` 접두사가 붙은 이벤트이다.
373 | - `Tunneling` 이벤트는 `Tunneling` 이벤트를 처리하는 `Handler`가 없으면 `Bubbling` 이벤트를 처리하는 `Handler`를 찾는다.
374 |
375 | ### Bubbling
376 |
377 | - `Bubbling` 이벤트는 `Tunneling` 이벤트와 반대로 `UIElement`의 `Preview` 접두사가 붙지 않은 이벤트이다.
378 |
379 |
380 |
381 | ## Blog(순서 a ~ Z , ㄱ ~ ㅎ)
382 |
383 | - [Arong Note](https://arong.info/). : 일상 생활 내용 및 IT 프로그램 기술 관련 정보 정리하는 공간
384 | - [jamesnet214](https://blog.naver.com/jamesnet214). : WPF 개발 내용 및 인생 팁
385 | - [kjun](https://kjun.kr/). : C# 개발 내용 정리
386 | - [Kratos](https://christian289.github.io/). : C# 관련
387 |
388 |
--------------------------------------------------------------------------------
/src/LanguageApp/LanguageApp.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.5.33209.295
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LanguageApp", "LanguageApp\LanguageApp.csproj", "{16CCB226-A761-4865-B203-FF98EBDC8A34}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {16CCB226-A761-4865-B203-FF98EBDC8A34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {16CCB226-A761-4865-B203-FF98EBDC8A34}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {16CCB226-A761-4865-B203-FF98EBDC8A34}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {16CCB226-A761-4865-B203-FF98EBDC8A34}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {B60D5675-B025-48FE-9378-D3C6AE155224}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/src/LanguageApp/LanguageApp/App.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
44 |
45 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/src/LanguageApp/LanguageApp/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 LanguageApp
10 | {
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | private static Dictionary _languages;
17 | private static ResourceDictionary _currentLanguage;
18 |
19 | private static Dictionary _themes;
20 | private static ResourceDictionary _currentTheme;
21 |
22 | public App()
23 | {
24 | #region Languages
25 |
26 | ResourceDictionary korean = GetResource("Korean");
27 | ResourceDictionary english = GetResource("English");
28 | ResourceDictionary chinese = GetResource("Chinese");
29 |
30 | _languages = new();
31 | _languages.Add("KOR", korean);
32 | _languages.Add("ENG", english);
33 | _languages.Add("CHN", chinese);
34 | #endregion
35 |
36 | #region Themes
37 |
38 | ResourceDictionary dark = GetResource("Dark");
39 | ResourceDictionary white = GetResource("White");
40 |
41 | _themes = new();
42 | _themes.Add("DAK", dark);
43 | _themes.Add("WHI", white);
44 | #endregion
45 | }
46 |
47 | private ResourceDictionary GetResource(string nation)
48 | {
49 | ResourceDictionary resource = new();
50 | resource.Source = new Uri($"/LanguageApp;component/Themes/{nation}.xaml", UriKind.RelativeOrAbsolute);
51 |
52 | return resource;
53 | }
54 |
55 | internal static void SwitchLanguage(LanguageModel language)
56 | {
57 | App.Current.Resources.MergedDictionaries.Remove(_currentLanguage);
58 | App.Current.Resources.MergedDictionaries.Add(_languages[language.Code]);
59 | }
60 |
61 | internal static void SwitchTheme(ThemeModel theme)
62 | {
63 | App.Current.Resources.MergedDictionaries.Remove(_currentTheme);
64 | App.Current.Resources.MergedDictionaries.Add(_themes[theme.Code]);
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/LanguageApp/LanguageApp/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | [assembly: ThemeInfo(
4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5 | //(used if a resource is not found in the page,
6 | // or application resource dictionaries)
7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8 | //(used if a resource is not found in the page,
9 | // app, or any theme specific resource dictionaries)
10 | )]
11 |
--------------------------------------------------------------------------------
/src/LanguageApp/LanguageApp/LanguageApp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net7.0-windows
6 | disable
7 | true
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/LanguageApp/LanguageApp/LanguageModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace LanguageApp
4 | {
5 | public class LanguageModel
6 | {
7 | public string Code { get; private set; }
8 | public string Name { get; private set; }
9 |
10 | internal LanguageModel DataGen(string code, string name)
11 | {
12 | Code = code;
13 | Name = name;
14 | return this;
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/src/LanguageApp/LanguageApp/MainViewModel.cs:
--------------------------------------------------------------------------------
1 | using CommunityToolkit.Mvvm.ComponentModel;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Runtime.CompilerServices;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using System.Windows;
9 | using System.Windows.Documents;
10 | using System.Xml.Linq;
11 |
12 | namespace LanguageApp
13 | {
14 | public class MainViewModel : ObservableObject
15 | {
16 | private LanguageModel _language;
17 | private ThemeModel _theme;
18 |
19 | public List Languages { get; init; }
20 | public List Themes { get; init; }
21 |
22 | public LanguageModel Language
23 | {
24 | get => _language;
25 | set => SetProperty2(ref _language, value, LanguageChanged);
26 | }
27 |
28 | public ThemeModel Theme
29 | {
30 | get => _theme;
31 | set => SetProperty2(ref _theme, value, ThemeChanged);
32 | }
33 |
34 | public List Teams { get; private set; }
35 |
36 | public MainViewModel()
37 | {
38 | Languages = GetLanguages();
39 | Language = Languages.FirstOrDefault();
40 |
41 | Themes = GetThemes();
42 | Theme = Themes.FirstOrDefault();
43 |
44 | Teams = GetTeams();
45 | }
46 |
47 | private List GetTeams()
48 | {
49 | List source = new();
50 | source.Add(new TeamModel().DataGen("EPL", null, "잉글랜드"));
51 | source.Add(new TeamModel().DataGen("SPL", null, "스페인"));
52 | source.Add(new TeamModel().DataGen("ITL", null, "이탈리아"));
53 |
54 | source[0].Children.Add(new TeamModel().DataGen("TOT", "EPL", "토트넘"));
55 | source[0].Children.Add(new TeamModel().DataGen("ARS", "EPL", "아스널"));
56 | source[0].Children.Add(new TeamModel().DataGen("CHE", "EPL", "첼시"));
57 |
58 | source[0].Children[0].Children.Add(new TeamModel().DataGen("07", "TOT", "손흥민"));
59 | source[0].Children[0].Children.Add(new TeamModel().DataGen("19", "TOT", "이강인"));
60 | source[0].Children[0].Children.Add(new TeamModel().DataGen("05", "TOT", "김민재"));
61 | return source;
62 | }
63 |
64 | private List GetLanguages()
65 | {
66 | List source = new();
67 | source.Add(new LanguageModel().DataGen("KOR", "Korean"));
68 | source.Add(new LanguageModel().DataGen("ENG", "English"));
69 | source.Add(new LanguageModel().DataGen("CHN", "Chinese"));
70 | return source;
71 | }
72 |
73 | private List GetThemes()
74 | {
75 | List source = new();
76 | source.Add(new ThemeModel().DataGen("DAK", "Dark"));
77 | source.Add(new ThemeModel().DataGen("WHI", "White"));
78 | return source;
79 | }
80 |
81 | private void LanguageChanged(LanguageModel value)
82 | {
83 | App.SwitchLanguage(value);
84 | }
85 |
86 | private void ThemeChanged(ThemeModel value)
87 | {
88 | App.SwitchTheme(value);
89 | }
90 |
91 | private void SetProperty2(ref T value1, T value2, Action changed, [CallerMemberName] string name = null)
92 | {
93 | OnPropertyChanged(name);
94 | value1 = value2;
95 | changed.Invoke(value2);
96 | }
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/src/LanguageApp/LanguageApp/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
14 |
17 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/LanguageApp/LanguageApp/MainWindow.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.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace LanguageApp
17 | {
18 | ///
19 | /// Interaction logic for MainWindow.xaml
20 | ///
21 | public partial class MainWindow : Window
22 | {
23 | public MainWindow()
24 | {
25 | InitializeComponent();
26 |
27 | DataContext = new MainViewModel();
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/LanguageApp/LanguageApp/TeamModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Windows.Documents;
4 |
5 | namespace LanguageApp
6 | {
7 | public class TeamModel
8 | {
9 | public string Id { get; private set; }
10 | public object Parent { get; private set; }
11 | public string Name { get; private set; }
12 | public List Children { get; set; }
13 | internal TeamModel DataGen(string id, object parent, string name)
14 | {
15 | Id = id;
16 | Parent = parent;
17 | Name = name;
18 | Children = new();
19 | return this;
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/src/LanguageApp/LanguageApp/ThemeModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml.Linq;
3 |
4 | namespace LanguageApp
5 | {
6 | public class ThemeModel
7 | {
8 | public string Code { get; private set; }
9 | public string Name { get; private set; }
10 |
11 | internal ThemeModel DataGen(string code, string name)
12 | {
13 | Code = code;
14 | Name = name;
15 | return this;
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/src/LanguageApp/LanguageApp/Themes/Chinese.xaml:
--------------------------------------------------------------------------------
1 |
4 | James 앱22
5 | 한국어22
6 | 영어22
7 | 중국어22
8 | 일본어22
9 | Dark33333
10 | White33333
11 |
--------------------------------------------------------------------------------
/src/LanguageApp/LanguageApp/Themes/Dark.xaml:
--------------------------------------------------------------------------------
1 |
3 | #000000
4 | #ffffff
5 |
--------------------------------------------------------------------------------
/src/LanguageApp/LanguageApp/Themes/English.xaml:
--------------------------------------------------------------------------------
1 |
4 | James App
5 | Korean
6 | English
7 | Chinese
8 | Japanese
9 | Dark
10 | White
11 |
--------------------------------------------------------------------------------
/src/LanguageApp/LanguageApp/Themes/Korean.xaml:
--------------------------------------------------------------------------------
1 |
4 | James 앱
5 | 한국어
6 | 영어
7 | 중국어
8 | 일본어
9 | 다크
10 | 화이트
11 |
--------------------------------------------------------------------------------
/src/LanguageApp/LanguageApp/Themes/White.xaml:
--------------------------------------------------------------------------------
1 |
3 | #ffffff
4 | #000000
5 |
--------------------------------------------------------------------------------
/src/WpfApp/WpfApp.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.5.33209.295
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfApp", "WpfApp\WpfApp.csproj", "{BFB0CE0E-FF99-49DE-9D3D-464422FA3A6C}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {BFB0CE0E-FF99-49DE-9D3D-464422FA3A6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {BFB0CE0E-FF99-49DE-9D3D-464422FA3A6C}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {BFB0CE0E-FF99-49DE-9D3D-464422FA3A6C}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {BFB0CE0E-FF99-49DE-9D3D-464422FA3A6C}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {DC529649-BEA8-48CB-B7F8-919321EBB187}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/src/WpfApp/WpfApp/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
63 |
91 |
92 |
93 |
124 |
125 |
137 |
138 |
139 |
--------------------------------------------------------------------------------
/src/WpfApp/WpfApp/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 WpfApp
10 | {
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/WpfApp/WpfApp/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | [assembly: ThemeInfo(
4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5 | //(used if a resource is not found in the page,
6 | // or application resource dictionaries)
7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8 | //(used if a resource is not found in the page,
9 | // app, or any theme specific resource dictionaries)
10 | )]
11 |
--------------------------------------------------------------------------------
/src/WpfApp/WpfApp/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
20 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
108 |
109 |
110 |
111 |
--------------------------------------------------------------------------------
/src/WpfApp/WpfApp/MainWindow.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.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace WpfApp
17 | {
18 | ///
19 | /// Interaction logic for MainWindow.xaml
20 | ///
21 | public partial class MainWindow : Window
22 | {
23 | public MainWindow()
24 | {
25 | InitializeComponent();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/WpfApp/WpfApp/WpfApp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net7.0-windows
6 | enable
7 | true
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/WpfBtApp/WpfBtApp.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.5.33209.295
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfBtApp", "WpfBtApp\WpfBtApp.csproj", "{24B6CE5A-6CBB-48F8-8D76-2D64162833D7}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {24B6CE5A-6CBB-48F8-8D76-2D64162833D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {24B6CE5A-6CBB-48F8-8D76-2D64162833D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {24B6CE5A-6CBB-48F8-8D76-2D64162833D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {24B6CE5A-6CBB-48F8-8D76-2D64162833D7}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {28E43F7A-5C73-47F3-9A31-4BF2C18574CD}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/src/WpfBtApp/WpfBtApp/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/WpfBtApp/WpfBtApp/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 WpfBtApp
10 | {
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/WpfBtApp/WpfBtApp/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | [assembly: ThemeInfo(
4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5 | //(used if a resource is not found in the page,
6 | // or application resource dictionaries)
7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8 | //(used if a resource is not found in the page,
9 | // app, or any theme specific resource dictionaries)
10 | )]
11 |
--------------------------------------------------------------------------------
/src/WpfBtApp/WpfBtApp/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
11 |
13 |
16 |
22 |
23 |
25 | asdf
26 | asdf
27 | asdf
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/src/WpfBtApp/WpfBtApp/MainWindow.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.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace WpfBtApp
17 | {
18 | ///
19 | /// Interaction logic for MainWindow.xaml
20 | ///
21 | public partial class MainWindow : Window
22 | {
23 | public MainWindow()
24 | {
25 | InitializeComponent();
26 |
27 | lbx.PreviewMouseLeftButtonDown += Lbx_PreviewMouseLeftButtonDown;
28 | }
29 |
30 | private void Lbx_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
31 | {
32 | }
33 |
34 | private void TextBlock_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
35 | {
36 |
37 | }
38 |
39 | private void Window_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
40 | {
41 | }
42 |
43 | private void Grid_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
44 | {
45 |
46 | }
47 |
48 | private void StackPanel_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
49 | {
50 |
51 | }
52 |
53 | private void TextBlock_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
54 | {
55 | e.Handled = true;
56 | }
57 |
58 | private void StackPanel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
59 | {
60 |
61 | }
62 |
63 | private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
64 | {
65 |
66 | }
67 |
68 | private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
69 | {
70 |
71 | }
72 |
73 | private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
74 | {
75 |
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/src/WpfBtApp/WpfBtApp/WpfBtApp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net7.0-windows
6 | enable
7 | true
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/WpfPracticeApp/WpfCustomApp/App.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using WpfCustomApp.UI.Views;
3 |
4 | namespace WpfCustomApp
5 | {
6 | public class App : Application
7 | {
8 | protected override void OnStartup(StartupEventArgs e)
9 | {
10 | base.OnStartup(e);
11 |
12 | PracticeWindow window = new();
13 | window.ShowDialog();
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/src/WpfPracticeApp/WpfCustomApp/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | [assembly: ThemeInfo(
4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5 | //(used if a resource is not found in the page,
6 | // or application resource dictionaries)
7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8 | //(used if a resource is not found in the page,
9 | // app, or any theme specific resource dictionaries)
10 | )]
11 |
--------------------------------------------------------------------------------
/src/WpfPracticeApp/WpfCustomApp/Starter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace WpfCustomApp
8 | {
9 | internal class Starter
10 | {
11 | [STAThread]
12 | private static void Main(string[] args)
13 | {
14 | App app = new();
15 | app.Run();
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/WpfPracticeApp/WpfCustomApp/Themes/Generic.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/WpfPracticeApp/WpfCustomApp/Themes/Units/StudyButton.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
25 |
26 |
--------------------------------------------------------------------------------
/src/WpfPracticeApp/WpfCustomApp/Themes/Units/StudyListBox.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
19 |
20 |
--------------------------------------------------------------------------------
/src/WpfPracticeApp/WpfCustomApp/Themes/Units/StudyListBoxItem.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
19 |
20 |
--------------------------------------------------------------------------------
/src/WpfPracticeApp/WpfCustomApp/UI/Units/StudyButton.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.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace WpfCustomApp.UI.Units
17 | {
18 | public class StudyButton : Button
19 | {
20 | static StudyButton()
21 | {
22 | DefaultStyleKeyProperty.OverrideMetadata(typeof(StudyButton), new FrameworkPropertyMetadata(typeof(StudyButton)));
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/WpfPracticeApp/WpfCustomApp/UI/Units/StudyListBox.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
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 | using WpfCustomApp.UI.Views;
17 |
18 | namespace WpfCustomApp.UI.Units
19 | {
20 | public class StudyListBox : ListBox
21 | {
22 | static StudyListBox()
23 | {
24 | DefaultStyleKeyProperty.OverrideMetadata(typeof(StudyListBox), new FrameworkPropertyMetadata(typeof(StudyListBox)));
25 | }
26 |
27 | public StudyListBox()
28 | {
29 |
30 | ItemsSource = GetSamples();
31 | }
32 |
33 | private IEnumerable GetSamples()
34 | {
35 | List users = new();
36 | users.Add(new User().GenData("James", "Seoul"));
37 | users.Add(new User().GenData("Vicky", "Napoli"));
38 | users.Add(new User().GenData("Harry", "Paris"));
39 | users.Add(new User().GenData("Luke", "London"));
40 |
41 | return users;
42 | }
43 |
44 | protected override DependencyObject GetContainerForItemOverride()
45 | {
46 | return new StudyListBoxItem();
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/WpfPracticeApp/WpfCustomApp/UI/Units/StudyListBoxItem.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.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace WpfCustomApp.UI.Units
17 | {
18 | public class StudyListBoxItem : ListBoxItem
19 | {
20 | static StudyListBoxItem()
21 | {
22 | DefaultStyleKeyProperty.OverrideMetadata(typeof(StudyListBoxItem), new FrameworkPropertyMetadata(typeof(StudyListBoxItem)));
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/WpfPracticeApp/WpfCustomApp/UI/Views/PracticeWindow.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/WpfPracticeApp/WpfCustomApp/UI/Views/PracticeWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
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.Shapes;
15 |
16 | namespace WpfCustomApp.UI.Views
17 | {
18 | ///
19 | /// PracticeWindow.xaml에 대한 상호 작용 논리
20 | ///
21 | public partial class PracticeWindow : Window
22 | {
23 | public PracticeWindow()
24 | {
25 | InitializeComponent();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/WpfPracticeApp/WpfCustomApp/UI/Views/User.cs:
--------------------------------------------------------------------------------
1 | namespace WpfCustomApp.UI.Views
2 | {
3 | internal class User
4 | {
5 | public string Name { get; private set; }
6 | public string Location { get; private set; }
7 |
8 | internal User GenData(string name, string location)
9 | {
10 | var user = new User();
11 | user.Name = name;
12 | user.Location = location;
13 | return user;
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/src/WpfPracticeApp/WpfCustomApp/WpfCustomApp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net7.0-windows
6 | enable
7 | true
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/src/WpfPracticeApp/WpfPracticeApp.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.5.33209.295
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfPracticeApp", "WpfPracticeApp\WpfPracticeApp.csproj", "{A9B854C3-063F-41A4-8241-57BD08E31509}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfCustomApp", "WpfCustomApp\WpfCustomApp.csproj", "{3A6E7DD7-D8EC-4A2C-A481-826BA83570BA}"
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 | {A9B854C3-063F-41A4-8241-57BD08E31509}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {A9B854C3-063F-41A4-8241-57BD08E31509}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {A9B854C3-063F-41A4-8241-57BD08E31509}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {A9B854C3-063F-41A4-8241-57BD08E31509}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {3A6E7DD7-D8EC-4A2C-A481-826BA83570BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {3A6E7DD7-D8EC-4A2C-A481-826BA83570BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {3A6E7DD7-D8EC-4A2C-A481-826BA83570BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {3A6E7DD7-D8EC-4A2C-A481-826BA83570BA}.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 = {F1A012F6-5E08-45EF-9EAD-B5E8F91DA6EA}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/src/WpfPracticeApp/WpfPracticeApp/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/WpfPracticeApp/WpfPracticeApp/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 WpfPracticeApp
10 | {
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/WpfPracticeApp/WpfPracticeApp/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | [assembly: ThemeInfo(
4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5 | //(used if a resource is not found in the page,
6 | // or application resource dictionaries)
7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8 | //(used if a resource is not found in the page,
9 | // app, or any theme specific resource dictionaries)
10 | )]
11 |
--------------------------------------------------------------------------------
/src/WpfPracticeApp/WpfPracticeApp/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/WpfPracticeApp/WpfPracticeApp/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
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 WpfPracticeApp
18 | {
19 | ///
20 | /// Interaction logic for MainWindow.xaml
21 | ///
22 | public partial class MainWindow : Window
23 | {
24 | public MainWindow()
25 | {
26 | InitializeComponent();
27 |
28 | lbx.ItemsSource = GetSamples();
29 | }
30 |
31 | private IEnumerable GetSamples()
32 | {
33 | List users = new();
34 | users.Add(new User().GenData("James", "Seoul"));
35 | users.Add(new User().GenData("Vicky", "Napoli"));
36 | users.Add(new User().GenData("Harry", "Paris"));
37 | users.Add(new User().GenData("Luke", "London"));
38 |
39 | return users;
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/WpfPracticeApp/WpfPracticeApp/Resources/ListBoxStyles.xaml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
41 |
42 |
87 |
--------------------------------------------------------------------------------
/src/WpfPracticeApp/WpfPracticeApp/User.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace WpfPracticeApp
4 | {
5 | internal class User
6 | {
7 | public string Name { get; private set; }
8 | public string Location { get; private set; }
9 |
10 | internal User GenData(string name, string location)
11 | {
12 | var user = new User();
13 | user.Name = name;
14 | user.Location = location;
15 | return user;
16 | }
17 | }
18 | }
--------------------------------------------------------------------------------
/src/WpfPracticeApp/WpfPracticeApp/WpfPracticeApp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net7.0-windows
6 | enable
7 | true
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/wpfexplorer/WpfExplorer/WpfExplorer.Forms/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | [assembly: ThemeInfo(
4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5 | //(used if a resource is not found in the page,
6 | // or application resource dictionaries)
7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8 | //(used if a resource is not found in the page,
9 | // app, or any theme specific resource dictionaries)
10 | )]
11 |
--------------------------------------------------------------------------------
/src/wpfexplorer/WpfExplorer/WpfExplorer.Forms/Local/ViewModels/ExplorerViewModel.cs:
--------------------------------------------------------------------------------
1 | using CommunityToolkit.Mvvm.ComponentModel;
2 | using Jamesnet.Wpf.Controls;
3 | using Jamesnet.Wpf.Mvvm;
4 | using Prism.Ioc;
5 | using Prism.Regions;
6 | using System;
7 | using System.Collections.Generic;
8 | using System.Linq;
9 | using System.Text;
10 | using System.Threading.Tasks;
11 | using System.Windows;
12 | using WpfExplorer.Support.Local.Helpers;
13 |
14 | namespace WpfExplorer.Forms.Local.ViewModels
15 | {
16 | public partial class ExplorerViewModel : ObservableBase, IViewLoadable
17 | {
18 | private readonly IContainerProvider _containerProvider;
19 | private readonly IRegionManager _regionManager;
20 | [ObservableProperty]
21 | private object _content;
22 |
23 | public ExplorerViewModel(DirectoryManager directoryManager, IContainerProvider containerProvider, IRegionManager regionManager)
24 | {
25 | _containerProvider = containerProvider;
26 | _regionManager = regionManager;
27 | }
28 |
29 | public void OnLoaded(IViewable view)
30 | {
31 | ImportContent("MainContent", "MainRegion");
32 | ImportContent("LocationContent", "LocationRegion");
33 | }
34 |
35 | private void ImportContent(string contentName, string regionName)
36 | {
37 | IViewable content = _containerProvider.Resolve(contentName);
38 | IRegion region = _regionManager.Regions[regionName];
39 |
40 | if (!region.Views.Contains(content))
41 | {
42 | region.Add(content);
43 | }
44 | region.Activate(content);
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/wpfexplorer/WpfExplorer/WpfExplorer.Forms/Themes/Generic.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/wpfexplorer/WpfExplorer/WpfExplorer.Forms/Themes/Views/ExplorerWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
24 |
25 |
--------------------------------------------------------------------------------
/src/wpfexplorer/WpfExplorer/WpfExplorer.Forms/UI/Views/ExplorerWindow.cs:
--------------------------------------------------------------------------------
1 | using Jamesnet.Wpf.Controls;
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 WpfExplorer.Forms.Local.ViewModels;
9 | using WpfExplorer.Support.UI.Units;
10 |
11 | namespace WpfExplorer.Forms.UI.Views
12 | {
13 | public class ExplorerWindow : DarkWindow
14 | {
15 | static ExplorerWindow()
16 | {
17 | DefaultStyleKeyProperty.OverrideMetadata(typeof(ExplorerWindow),
18 | new FrameworkPropertyMetadata(typeof(ExplorerWindow)));
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/wpfexplorer/WpfExplorer/WpfExplorer.Forms/WpfExplorer.Forms.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net7.0-windows
5 | enable
6 | true
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/wpfexplorer/WpfExplorer/WpfExplorer.Location/Local/ViewModels/LocationContentViewModel.cs:
--------------------------------------------------------------------------------
1 | using CommunityToolkit.Mvvm.ComponentModel;
2 | using CommunityToolkit.Mvvm.Input;
3 | using Jamesnet.Wpf.Mvvm;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using WpfExplorer.Support.Local.Helpers;
10 | using WpfExplorer.Support.Local.Models;
11 |
12 | namespace WpfExplorer.Location.Local.ViewModels
13 | {
14 | public partial class LocationContentViewModel : ObservableBase
15 | {
16 | private readonly NavigatorService _navigatorService;
17 |
18 | [ObservableProperty]
19 | private FileInfoBase _current;
20 |
21 | public LocationContentViewModel(NavigatorService navigatorService)
22 | {
23 | _navigatorService = navigatorService;
24 | _navigatorService.LocationChanged += _navigatorService_LocationChanged;
25 | }
26 |
27 | private void _navigatorService_LocationChanged(object? sender, Support.Local.Models.LocationChangedEventArgs e)
28 | {
29 | Current = e.Current;
30 | }
31 |
32 | [RelayCommand]
33 | private void GoBack()
34 | {
35 | _navigatorService.GoBack();
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/wpfexplorer/WpfExplorer/WpfExplorer.Location/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | [assembly: ThemeInfo(
4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5 | //(used if a resource is not found in the page,
6 | // or application resource dictionaries)
7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8 | //(used if a resource is not found in the page,
9 | // app, or any theme specific resource dictionaries)
10 | )]
11 |
--------------------------------------------------------------------------------
/src/wpfexplorer/WpfExplorer/WpfExplorer.Location/Themes/Generic.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/wpfexplorer/WpfExplorer/WpfExplorer.Location/Themes/Views/LocationContent.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
24 |
25 |
--------------------------------------------------------------------------------
/src/wpfexplorer/WpfExplorer/WpfExplorer.Location/UI/Views/LocationContent.cs:
--------------------------------------------------------------------------------
1 | using Jamesnet.Wpf.Controls;
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 WpfExplorer.Location.UI.Views
18 | {
19 | public class LocationContent : JamesContent
20 | {
21 | static LocationContent()
22 | {
23 | DefaultStyleKeyProperty.OverrideMetadata(typeof(LocationContent), new FrameworkPropertyMetadata(typeof(LocationContent)));
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/wpfexplorer/WpfExplorer/WpfExplorer.Location/WpfExplorer.Location.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net7.0-windows
5 | enable
6 | true
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/wpfexplorer/WpfExplorer/WpfExplorer.Main/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | [assembly: ThemeInfo(
4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5 | //(used if a resource is not found in the page,
6 | // or application resource dictionaries)
7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8 | //(used if a resource is not found in the page,
9 | // app, or any theme specific resource dictionaries)
10 | )]
11 |
--------------------------------------------------------------------------------
/src/wpfexplorer/WpfExplorer/WpfExplorer.Main/Local/ViewModels/MainContentViewModel.cs:
--------------------------------------------------------------------------------
1 | using CommunityToolkit.Mvvm.Input;
2 | using Jamesnet.Wpf.Mvvm;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Collections.ObjectModel;
6 | using System.IO;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 | using System.Windows;
11 | using System.Windows.Input;
12 | using WpfExplorer.Support.Local.Helpers;
13 | using WpfExplorer.Support.Local.Models;
14 |
15 | namespace WpfExplorer.Main.Local.ViewModels
16 | {
17 | public partial class MainContentViewModel : ObservableBase
18 | {
19 | private readonly FileService _fileService;
20 | private readonly NavigatorService _navigatorService;
21 |
22 | public List Roots { get; init; }
23 |
24 | public ObservableCollection Files { get; init; }
25 |
26 | public MainContentViewModel(FileService fileService, NavigatorService navigatorService)
27 | {
28 | _fileService = fileService;
29 | _navigatorService = navigatorService;
30 | Roots = _fileService.GenerateRootNodes();
31 | Files = new();
32 |
33 | _navigatorService.LocationChanged += _navigatorService_LocationChanged;
34 | }
35 |
36 | private void _navigatorService_LocationChanged(object? sender, LocationChangedEventArgs e)
37 | {
38 | List source = GetDirectoryItems(e.Current.FullPath);
39 |
40 | Files.Clear();
41 | Files.AddRange(source);
42 | }
43 |
44 | private List GetDirectoryItems(string fullPath)
45 | {
46 | List items = new();
47 | string[] dirs = Directory.GetDirectories(fullPath);
48 | foreach (string path in dirs)
49 | {
50 | items.Add(new FolderInfo { FullPath = path });
51 | }
52 |
53 | string[] files = Directory.GetFiles(fullPath);
54 | foreach (string path in files)
55 | {
56 | items.Add(new FolderInfo { FullPath = path });
57 | }
58 | return items;
59 | }
60 |
61 | [RelayCommand]
62 | private void FolderChanged(FolderInfo item)
63 | {
64 | _fileService.RefreshSubdirectories(item);
65 | _navigatorService.ChangeLocation(item);
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/wpfexplorer/WpfExplorer/WpfExplorer.Main/Themes/Generic.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/wpfexplorer/WpfExplorer/WpfExplorer.Main/Themes/Units/ExpandButton.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
13 |
14 |
31 |
--------------------------------------------------------------------------------
/src/wpfexplorer/WpfExplorer/WpfExplorer.Main/Themes/Units/FolderTreeItem.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
83 |
84 |
--------------------------------------------------------------------------------
/src/wpfexplorer/WpfExplorer/WpfExplorer.Main/Themes/Units/FolderTreeView.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
16 |
17 |
--------------------------------------------------------------------------------
/src/wpfexplorer/WpfExplorer/WpfExplorer.Main/Themes/Views/MainContent.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
28 |
29 |
--------------------------------------------------------------------------------
/src/wpfexplorer/WpfExplorer/WpfExplorer.Main/UI/Units/ExpandButton.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.Primitives;
8 |
9 | namespace WpfExplorer.Main.UI.Units
10 | {
11 | public class ExpandButton : ToggleButton
12 | {
13 | static ExpandButton()
14 | {
15 | DefaultStyleKeyProperty.OverrideMetadata(typeof(ExpandButton),
16 | new FrameworkPropertyMetadata(typeof(ExpandButton)));
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/wpfexplorer/WpfExplorer/WpfExplorer.Main/UI/Units/FolderTreeItem.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls;
3 |
4 | namespace WpfExplorer.Main.UI.Units
5 | {
6 | public class FolderTreeItem : TreeViewItem
7 | {
8 | static FolderTreeItem()
9 | {
10 | DefaultStyleKeyProperty.OverrideMetadata(typeof(FolderTreeItem), new FrameworkPropertyMetadata(typeof(FolderTreeItem)));
11 | }
12 |
13 | protected override DependencyObject GetContainerForItemOverride()
14 | {
15 | return new FolderTreeItem();
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/wpfexplorer/WpfExplorer/WpfExplorer.Main/UI/Units/FolderTreeView.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls;
3 | using System.Windows.Input;
4 | using WpfExplorer.Support.Local.Models;
5 |
6 | namespace WpfExplorer.Main.UI.Units
7 | {
8 | public class FolderTreeView : TreeView
9 | {
10 | public static readonly DependencyProperty SelectionCommandProperty =
11 | DependencyProperty.Register("SelectionCommand", typeof(ICommand), typeof(FolderTreeView));
12 |
13 | public ICommand SelectionCommand
14 | {
15 | get => (ICommand)GetValue(SelectionCommandProperty);
16 | set => SetValue(SelectionCommandProperty, value);
17 | }
18 |
19 | static FolderTreeView()
20 | {
21 | DefaultStyleKeyProperty.OverrideMetadata(typeof(FolderTreeView),
22 | new FrameworkPropertyMetadata(typeof(FolderTreeView)));
23 | }
24 |
25 | protected override DependencyObject GetContainerForItemOverride()
26 | {
27 | return new FolderTreeItem();
28 | }
29 |
30 | public FolderTreeView()
31 | {
32 | SelectedItemChanged += FolderTreeView_SelectedItemChanged;
33 | }
34 |
35 | private void FolderTreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs