├── .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 | 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 | ![DataTemplate Test](https://user-images.githubusercontent.com/72642836/235357755-1ed92831-42a2-4092-918c-9540b061420e.png) 172 | 173 | ```xml 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 241 | ``` 242 | 243 | 244 | ## 5. ContentControl 245 | 246 | - ```Content``` 프로퍼티를 갖고 있다. 247 | - ```Content``` 타입은 ```object``` 로 다른 Control 을 넣을 수 있다. 248 | 249 | ```xml 250 | 251 | 262 | ``` 263 | 264 | 265 | - ```Content``` 로 문자열만 입력된 경우는 내부적으로 ```TextBlock```이 추가됐다고 볼 수 있다. 266 | 267 | ```xml 268 | 269 | 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 | 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` | | `Selector`에서 상속됨 | 354 | | `SelectionMode` | `SelectionMode`(Enum) | `ListBox` 의 선택 동작 정의 | | 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 |