├── .gitattributes ├── .gitignore ├── .gitmodules ├── LICENSE ├── README.md ├── XamlDisplayer ├── CodeDisplayer │ ├── BoolToDisplayModeConverter.cs │ ├── Changelog.md │ ├── CodeDisplayer.csproj │ ├── ControlPanel.xaml │ ├── ControlPanel.xaml.cs │ ├── DependencyPackage │ │ └── XamlStyler.Core.dll │ ├── FodyWeavers.xml │ ├── Helper.cs │ ├── LoadingScreen.xaml │ ├── LoadingScreen.xaml.cs │ ├── MvvmTextEditor.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ ├── XamlDisplayer.xaml │ ├── XamlDisplayer.xaml.cs │ ├── XamlDisplayerHost.cs │ ├── XamlDisplayerPanel.cs │ └── packages.config ├── Demo │ ├── App.config │ ├── App.xaml │ ├── App.xaml.cs │ ├── FodyWeavers.xml │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── Page1.xaml │ ├── Page1.xaml.cs │ ├── Properties │ │ ├── Annotations.cs │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ ├── XamlDisplayerDemo.csproj │ └── packages.config ├── DisplayXamlDemo.sln ├── DisplayXamlDemo.sln.DotSettings └── Package.nuspec └── icon.png /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | 28 | # MSTest test Results 29 | [Tt]est[Rr]esult*/ 30 | [Bb]uild[Ll]og.* 31 | 32 | # NUNIT 33 | *.VisualState.xml 34 | TestResult.xml 35 | 36 | # Build Results of an ATL Project 37 | [Dd]ebugPS/ 38 | [Rr]eleasePS/ 39 | dlldata.c 40 | 41 | # DNX 42 | project.lock.json 43 | artifacts/ 44 | 45 | *_i.c 46 | *_p.c 47 | *_i.h 48 | *.ilk 49 | *.meta 50 | *.obj 51 | *.pch 52 | *.pdb 53 | *.pgc 54 | *.pgd 55 | *.rsp 56 | *.sbr 57 | *.tlb 58 | *.tli 59 | *.tlh 60 | *.tmp 61 | *.tmp_proj 62 | *.log 63 | *.vspscc 64 | *.vssscc 65 | .builds 66 | *.pidb 67 | *.svclog 68 | *.scc 69 | 70 | # Chutzpah Test files 71 | _Chutzpah* 72 | 73 | # Visual C++ cache files 74 | ipch/ 75 | *.aps 76 | *.ncb 77 | *.opensdf 78 | *.sdf 79 | *.cachefile 80 | 81 | # Visual Studio profiler 82 | *.psess 83 | *.vsp 84 | *.vspx 85 | 86 | # TFS 2012 Local Workspace 87 | $tf/ 88 | 89 | # Guidance Automation Toolkit 90 | *.gpState 91 | 92 | # ReSharper is a .NET coding add-in 93 | _ReSharper*/ 94 | *.[Rr]e[Ss]harper 95 | *.DotSettings.user 96 | 97 | # JustCode is a .NET coding add-in 98 | .JustCode 99 | 100 | # TeamCity is a build add-in 101 | _TeamCity* 102 | 103 | # DotCover is a Code Coverage Tool 104 | *.dotCover 105 | 106 | # NCrunch 107 | _NCrunch_* 108 | .*crunch*.local.xml 109 | 110 | # MightyMoose 111 | *.mm.* 112 | AutoTest.Net/ 113 | 114 | # Web workbench (sass) 115 | .sass-cache/ 116 | 117 | # Installshield output folder 118 | [Ee]xpress/ 119 | 120 | # DocProject is a documentation generator add-in 121 | DocProject/buildhelp/ 122 | DocProject/Help/*.HxT 123 | DocProject/Help/*.HxC 124 | DocProject/Help/*.hhc 125 | DocProject/Help/*.hhk 126 | DocProject/Help/*.hhp 127 | DocProject/Help/Html2 128 | DocProject/Help/html 129 | 130 | # Click-Once directory 131 | publish/ 132 | 133 | # Publish Web Output 134 | *.[Pp]ublish.xml 135 | *.azurePubxml 136 | ## TODO: Comment the next line if you want to checkin your 137 | ## web deploy settings but do note that will include unencrypted 138 | ## passwords 139 | #*.pubxml 140 | 141 | *.publishproj 142 | 143 | # NuGet Packages 144 | *.nupkg 145 | # The packages folder can be ignored because of Package Restore 146 | **/packages/* 147 | # except build/, which is used as an MSBuild target. 148 | !**/packages/build/ 149 | # Uncomment if necessary however generally it will be regenerated when needed 150 | #!**/packages/repositories.config 151 | 152 | # Windows Azure Build Output 153 | csx/ 154 | *.build.csdef 155 | 156 | # Windows Store app package directory 157 | AppPackages/ 158 | 159 | # Visual Studio cache files 160 | # files ending in .cache can be ignored 161 | *.[Cc]ache 162 | # but keep track of directories ending in .cache 163 | !*.[Cc]ache/ 164 | 165 | # Others 166 | ClientBin/ 167 | [Ss]tyle[Cc]op.* 168 | ~$* 169 | *~ 170 | *.dbmdl 171 | *.dbproj.schemaview 172 | *.pfx 173 | *.publishsettings 174 | node_modules/ 175 | orleans.codegen.cs 176 | 177 | # RIA/Silverlight projects 178 | Generated_Code/ 179 | 180 | # Backup & report files from converting an old project file 181 | # to a newer Visual Studio version. Backup files are not needed, 182 | # because we have git ;-) 183 | _UpgradeReport_Files/ 184 | Backup*/ 185 | UpgradeLog*.XML 186 | UpgradeLog*.htm 187 | 188 | # SQL Server files 189 | *.mdf 190 | *.ldf 191 | 192 | # Business Intelligence projects 193 | *.rdl.data 194 | *.bim.layout 195 | *.bim_*.settings 196 | 197 | # Microsoft Fakes 198 | FakesAssemblies/ 199 | 200 | # Node.js Tools for Visual Studio 201 | .ntvs_analysis.dat 202 | 203 | # Visual Studio 6 build log 204 | *.plg 205 | 206 | # Visual Studio 6 workspace options file 207 | *.opt 208 | 209 | # LightSwitch generated files 210 | GeneratedArtifacts/ 211 | _Pvt_Extensions/ 212 | ModelManifest.xml 213 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "XamlStyler"] 2 | path = XamlStyler 3 | url = https://github.com/Xavalon/XamlStyler.git 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # Displaying-XAML 3 | This library is for display the XAML code of theme library for WPF (e.g. MaterialDesignInXamlToolkit/MahApps) 4 | 5 | ## Why is this library written ? 6 | Because the demo app for the theme library I'm using ([MaterialDesignInXamlToolkit](https://github.com/ButchersBoy/MaterialDesignInXamlToolkit)) is too hard to use. 7 | For example, when I want to use a control in the demo, I have to search through its GitHub repo for the code. Obviously, this is a pain, therefore I wrote this library, so that the code can be displayed besides each control. 8 | 9 | ## Demo 10 | ![newdemo](https://user-images.githubusercontent.com/23183656/30123252-f3db094c-9363-11e7-9ae8-911789b6ae08.gif) 11 | 12 | ## How to use this library ? 13 | ### 1. Install from nuget 14 | `Install-Package XamlDisplayerPackage -Version 1.0.3 ` 15 | 16 | ### 2. Call the XamlDisplayerPanel initializer at the app startup 17 | ```C# 18 | private void App_OnStartup(object sender, StartupEventArgs e) { 19 | XamlDisplayerPanel.Initialize( 20 | source: 21 | XamlDisplayerPanel.SourceEnum.LoadFromLocal , 22 | defaultLocalPath: 23 | @"C:\Users\User\Source\Repos\Displaying-XAML\XamlDisplayer\Demo\" , 24 | defaultRemotePath: 25 | "https://raw.githubusercontent.com/wongjiahau/Displaying-XAML/master/XamlDisplayer/Demo/" , 26 | attributesToBeRemoved: 27 | new List() 28 | { 29 | "xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"" , 30 | "xmlns:materialDesign=\"http://materialdesigninxaml.net/winfx/xaml/themes\"" , 31 | "xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"" 32 | } 33 | ); 34 | } 35 | ``` 36 | - `source` determine where you want to load the XAML source file (either from local(your computer) or remote(e.g. GitHub) 37 | - `defaultLocalPath` determine where the files shall be loaded by default if you set `source` as `LoadFromLocal` 38 | - `defaultRemotePath` determine where the files shall be loaded by default if you set `source` as `LoadFromRemote` 39 | - `attributesToBeRemoved` specifies the attributes that should be filetered out when displaying the code for each control 40 | _Refer [here](https://msdn.microsoft.com/en-us/library/system.windows.application.startup(v=vs.110).aspx) to learn more about App_OnStartup method_ 41 | 42 | 43 | ### 3. At the place where all the pages are hosted (usually MainWindow.xaml), place in the XamlDisplayerHost 44 | ```xml 45 | 46 | 47 | 48 | ``` 49 | The XamlDisplayerHost is actually a Frame, so you can call the `Navigate` method using it. 50 | 51 | ### 4. For each of the page that is going to be navigated, surround all the controls with XamlDisplayerPanel 52 | ```xml 53 | 54 | 55 | 56 | 57 | 58 | ``` 59 | _Note : The XamlDisplayerPanel can be placed on any level of depth_ 60 | 61 | ### 5. Navigate to each pages by calling Navigate method of XamlDisplayerHost 62 | ```C# 63 | public MainWindow() { 64 | InitializeComponent(); 65 | XamlDisplayerHost.Navigate(new Page1()); 66 | } 67 | ``` 68 | _Actually, you can also use binding to bind its `Content`, because `XamlDisplayerHost` is inherited directly from `Frame`_ 69 | 70 | 71 | -------------------------------------------------------------------------------- /XamlDisplayer/CodeDisplayer/BoolToDisplayModeConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace CodeDisplayer { 6 | public class BoolToDisplayModeConverter : IValueConverter { 7 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { 8 | var input = (bool) value; 9 | if (input) { 10 | return XamlDisplayer.DisplayModeEnum.TopBottom; 11 | } 12 | else { 13 | return XamlDisplayer.DisplayModeEnum.LeftRight; 14 | } 15 | } 16 | 17 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { 18 | throw new NotImplementedException(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /XamlDisplayer/CodeDisplayer/Changelog.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | ## [1.0.6] 3 | ### Fix 4 | - Remove unnecessary frame, fixing Material Design In XAML demo 5 | 6 | ## [1.0.5] 7 | ### Change 8 | - Now element whose XamlDisplayer.DisplayCode is false will have left alignment and more top margin 9 | 10 | ## [1.0.4] 11 | ### Added 12 | - Added `IsControlPanelDisplayed` static property to XamlDisplayerPanel (which is set to false by default) 13 | - So that client can choose whether to display the control panel or not 14 | - Added `DisplayCode` attached property for XamlDisplayer 15 | - So that client can control which element should display code 16 | 17 | ### Change 18 | - Rename property `IsCodeDisplayed` to `IsCodeDisplayingPanelExpanded` (of XamlDisplayer) 19 | 20 | ## [1.0.3] 21 | ### Added 22 | - Added control panel, which contain the following components 23 | - Search bar 24 | - Toggles (for toggling visibility of code displaying panel) 25 | -------------------------------------------------------------------------------- /XamlDisplayer/CodeDisplayer/CodeDisplayer.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {AB0ACA42-1C9F-4823-A8C9-4594C5B70F4E} 8 | library 9 | CodeDisplayer 10 | CodeDisplayer 11 | v4.5 12 | 512 13 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 14 | 4 15 | 16 | 17 | 18 | 19 | 20 | true 21 | full 22 | false 23 | bin\Debug\ 24 | DEBUG;TRACE 25 | prompt 26 | 4 27 | 28 | 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | true 36 | 37 | 38 | 39 | ..\packages\Costura.Fody.1.6.2\lib\dotnet\Costura.dll 40 | False 41 | 42 | 43 | ..\packages\AvalonEdit.5.0.3\lib\Net40\ICSharpCode.AvalonEdit.dll 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 4.0 55 | 56 | 57 | 58 | 59 | 60 | DependencyPackage\XamlStyler.Core.dll 61 | 62 | 63 | 64 | 65 | 66 | ControlPanel.xaml 67 | 68 | 69 | 70 | LoadingScreen.xaml 71 | 72 | 73 | 74 | Code 75 | 76 | 77 | True 78 | True 79 | Resources.resx 80 | 81 | 82 | True 83 | Settings.settings 84 | True 85 | 86 | 87 | XamlDisplayer.xaml 88 | 89 | 90 | 91 | 92 | ResXFileCodeGenerator 93 | Resources.Designer.cs 94 | 95 | 96 | 97 | 98 | SettingsSingleFileGenerator 99 | Settings.Designer.cs 100 | 101 | 102 | 103 | 104 | Designer 105 | MSBuild:Compile 106 | 107 | 108 | Designer 109 | MSBuild:Compile 110 | 111 | 112 | Designer 113 | MSBuild:Compile 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 127 | 128 | 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /XamlDisplayer/CodeDisplayer/ControlPanel.xaml: -------------------------------------------------------------------------------- 1 |  8 | 9 | 10 | Search code : 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /XamlDisplayer/CodeDisplayer/ControlPanel.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 CodeDisplayer { 17 | /// 18 | /// Interaction logic for ControlPanel.xaml 19 | /// 20 | public partial class ControlPanel : UserControl { 21 | public ControlPanel() { 22 | InitializeComponent(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /XamlDisplayer/CodeDisplayer/DependencyPackage/XamlStyler.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wongjiahau/Displaying-XAML/5701c21049d4cbac24def1df4f0851634582c83c/XamlDisplayer/CodeDisplayer/DependencyPackage/XamlStyler.Core.dll -------------------------------------------------------------------------------- /XamlDisplayer/CodeDisplayer/FodyWeavers.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /XamlDisplayer/CodeDisplayer/Helper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Net; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace CodeDisplayer { 10 | public static class Helper { 11 | public static string DownloadFile(string sourceUrl) //https://gist.github.com/nboubakr/7812375 12 | { 13 | long existLen = 0; 14 | var httpReq = (HttpWebRequest) WebRequest.Create(sourceUrl); 15 | httpReq.AddRange((int) existLen); 16 | var httpRes = (HttpWebResponse) httpReq.GetResponse(); 17 | var responseStream = httpRes.GetResponseStream(); 18 | if (responseStream == null) return "Fail to fetch file"; 19 | var streamReader = new StreamReader(responseStream); 20 | return streamReader.ReadToEnd(); 21 | 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /XamlDisplayer/CodeDisplayer/LoadingScreen.xaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | Loading . . . 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /XamlDisplayer/CodeDisplayer/LoadingScreen.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Shapes; 14 | 15 | namespace CodeDisplayer { 16 | /// 17 | /// Interaction logic for LoadingScreen.xaml 18 | /// 19 | public partial class LoadingScreen : Window { 20 | private static LoadingScreen _current; 21 | private LoadingScreen() { 22 | InitializeComponent(); 23 | } 24 | 25 | public static void Display(string message) { 26 | _current = new LoadingScreen {TextBlock = {Text = message}}; 27 | _current.Show(); 28 | } 29 | 30 | public static void CloseDialog() { 31 | _current.Close(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /XamlDisplayer/CodeDisplayer/MvvmTextEditor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Windows; 4 | using ICSharpCode.AvalonEdit; 5 | 6 | namespace CodeDisplayer { 7 | //Refer to https://stackoverflow.com/questions/12344367/making-avalonedit-mvvm-compatible 8 | public class MvvmTextEditor : TextEditor, INotifyPropertyChanged { 9 | public static DependencyProperty CaretOffsetProperty = 10 | DependencyProperty.Register("CaretOffset" , typeof(int) , typeof(MvvmTextEditor) , 11 | // binding changed callback: set value of underlying property 12 | new PropertyMetadata((obj , args) => { 13 | MvvmTextEditor target = (MvvmTextEditor)obj; 14 | target.CaretOffset = (int)args.NewValue; 15 | }) 16 | ); 17 | 18 | public static DependencyProperty TextProperty = 19 | DependencyProperty.Register("Text" , typeof(string) , typeof(MvvmTextEditor) , 20 | // binding changed callback: set value of underlying property 21 | new PropertyMetadata((obj , args) => { 22 | MvvmTextEditor target = (MvvmTextEditor)obj; 23 | target.Text = (string)args.NewValue; 24 | }) 25 | ); 26 | 27 | 28 | public new string Text { 29 | get { return base.Text; } 30 | set { base.Text = value; } 31 | } 32 | 33 | public new int CaretOffset { 34 | get { return base.CaretOffset; } 35 | set { base.CaretOffset = value; } 36 | } 37 | 38 | public int Length { 39 | get { return base.Text.Length; } 40 | } 41 | 42 | protected override void OnTextChanged(EventArgs e) { 43 | RaisePropertyChanged("Length"); 44 | base.OnTextChanged(e); 45 | } 46 | 47 | public event PropertyChangedEventHandler PropertyChanged; 48 | 49 | public void RaisePropertyChanged(string info) { 50 | if (PropertyChanged != null) { 51 | PropertyChanged(this , new PropertyChangedEventArgs(info)); 52 | } 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /XamlDisplayer/CodeDisplayer/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [assembly: AssemblyTitle("CodeDisplayer")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("")] 14 | [assembly: AssemblyProduct("CodeDisplayer")] 15 | [assembly: AssemblyCopyright("Copyright © 2017")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // Setting ComVisible to false makes the types in this assembly not visible 20 | // to COM components. If you need to access a type in this assembly from 21 | // COM, set the ComVisible attribute to true on that type. 22 | [assembly: ComVisible(false)] 23 | 24 | //In order to begin building localizable applications, set 25 | //CultureYouAreCodingWith in your .csproj file 26 | //inside a . For example, if you are using US english 27 | //in your source files, set the to en-US. Then uncomment 28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 29 | //the line below to match the UICulture setting in the project file. 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly:ThemeInfo( 35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 36 | //(used if a resource is not found in the page, 37 | // or application resource dictionaries) 38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 39 | //(used if a resource is not found in the page, 40 | // app, or any theme specific resource dictionaries) 41 | )] 42 | 43 | 44 | // Version information for an assembly consists of the following four values: 45 | // 46 | // Major Version 47 | // Minor Version 48 | // Build Number 49 | // Revision 50 | // 51 | // You can specify all the values or you can default the Build and Revision Numbers 52 | // by using the '*' as shown below: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("1.0.0.0")] 55 | [assembly: AssemblyFileVersion("1.0.0.0")] 56 | -------------------------------------------------------------------------------- /XamlDisplayer/CodeDisplayer/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CodeDisplayer.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CodeDisplayer.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /XamlDisplayer/CodeDisplayer/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /XamlDisplayer/CodeDisplayer/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CodeDisplayer.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.1.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /XamlDisplayer/CodeDisplayer/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /XamlDisplayer/CodeDisplayer/XamlDisplayer.xaml: -------------------------------------------------------------------------------- 1 |  8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | 43 | 44 | 20 | 21 | This is a header 22 | 23 | 24 | 28 | 30 | 31 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /XamlDisplayer/Demo/Page1.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 XamlDisplayerDemo { 17 | /// 18 | /// Interaction logic for Page1.xaml 19 | /// 20 | public partial class Page1 : UserControl { 21 | public Page1() { 22 | InitializeComponent(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /XamlDisplayer/Demo/Properties/Annotations.cs: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | 3 | Copyright (c) 2016 JetBrains http://www.jetbrains.com 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 | 23 | using System; 24 | 25 | #pragma warning disable 1591 26 | // ReSharper disable UnusedMember.Global 27 | // ReSharper disable MemberCanBePrivate.Global 28 | // ReSharper disable UnusedAutoPropertyAccessor.Global 29 | // ReSharper disable IntroduceOptionalParameters.Global 30 | // ReSharper disable MemberCanBeProtected.Global 31 | // ReSharper disable InconsistentNaming 32 | 33 | namespace DisplayXamlDemo.Annotations 34 | { 35 | /// 36 | /// Indicates that the value of the marked element could be null sometimes, 37 | /// so the check for null is necessary before its usage. 38 | /// 39 | /// 40 | /// [CanBeNull] object Test() => null; 41 | /// 42 | /// void UseTest() { 43 | /// var p = Test(); 44 | /// var s = p.ToString(); // Warning: Possible 'System.NullReferenceException' 45 | /// } 46 | /// 47 | [AttributeUsage( 48 | AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | 49 | AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event | 50 | AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.GenericParameter)] 51 | public sealed class CanBeNullAttribute : Attribute { } 52 | 53 | /// 54 | /// Indicates that the value of the marked element could never be null. 55 | /// 56 | /// 57 | /// [NotNull] object Foo() { 58 | /// return null; // Warning: Possible 'null' assignment 59 | /// } 60 | /// 61 | [AttributeUsage( 62 | AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | 63 | AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event | 64 | AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.GenericParameter)] 65 | public sealed class NotNullAttribute : Attribute { } 66 | 67 | /// 68 | /// Can be appplied to symbols of types derived from IEnumerable as well as to symbols of Task 69 | /// and Lazy classes to indicate that the value of a collection item, of the Task.Result property 70 | /// or of the Lazy.Value property can never be null. 71 | /// 72 | [AttributeUsage( 73 | AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | 74 | AttributeTargets.Delegate | AttributeTargets.Field)] 75 | public sealed class ItemNotNullAttribute : Attribute { } 76 | 77 | /// 78 | /// Can be appplied to symbols of types derived from IEnumerable as well as to symbols of Task 79 | /// and Lazy classes to indicate that the value of a collection item, of the Task.Result property 80 | /// or of the Lazy.Value property can be null. 81 | /// 82 | [AttributeUsage( 83 | AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | 84 | AttributeTargets.Delegate | AttributeTargets.Field)] 85 | public sealed class ItemCanBeNullAttribute : Attribute { } 86 | 87 | /// 88 | /// Indicates that the marked method builds string by format pattern and (optional) arguments. 89 | /// Parameter, which contains format string, should be given in constructor. The format string 90 | /// should be in -like form. 91 | /// 92 | /// 93 | /// [StringFormatMethod("message")] 94 | /// void ShowError(string message, params object[] args) { /* do something */ } 95 | /// 96 | /// void Foo() { 97 | /// ShowError("Failed: {0}"); // Warning: Non-existing argument in format string 98 | /// } 99 | /// 100 | [AttributeUsage( 101 | AttributeTargets.Constructor | AttributeTargets.Method | 102 | AttributeTargets.Property | AttributeTargets.Delegate)] 103 | public sealed class StringFormatMethodAttribute : Attribute 104 | { 105 | /// 106 | /// Specifies which parameter of an annotated method should be treated as format-string 107 | /// 108 | public StringFormatMethodAttribute([NotNull] string formatParameterName) 109 | { 110 | FormatParameterName = formatParameterName; 111 | } 112 | 113 | [NotNull] public string FormatParameterName { get; private set; } 114 | } 115 | 116 | /// 117 | /// For a parameter that is expected to be one of the limited set of values. 118 | /// Specify fields of which type should be used as values for this parameter. 119 | /// 120 | [AttributeUsage( 121 | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field, 122 | AllowMultiple = true)] 123 | public sealed class ValueProviderAttribute : Attribute 124 | { 125 | public ValueProviderAttribute([NotNull] string name) 126 | { 127 | Name = name; 128 | } 129 | 130 | [NotNull] public string Name { get; private set; } 131 | } 132 | 133 | /// 134 | /// Indicates that the function argument should be string literal and match one 135 | /// of the parameters of the caller function. For example, ReSharper annotates 136 | /// the parameter of . 137 | /// 138 | /// 139 | /// void Foo(string param) { 140 | /// if (param == null) 141 | /// throw new ArgumentNullException("par"); // Warning: Cannot resolve symbol 142 | /// } 143 | /// 144 | [AttributeUsage(AttributeTargets.Parameter)] 145 | public sealed class InvokerParameterNameAttribute : Attribute { } 146 | 147 | /// 148 | /// Indicates that the method is contained in a type that implements 149 | /// System.ComponentModel.INotifyPropertyChanged interface and this method 150 | /// is used to notify that some property value changed. 151 | /// 152 | /// 153 | /// The method should be non-static and conform to one of the supported signatures: 154 | /// 155 | /// NotifyChanged(string) 156 | /// NotifyChanged(params string[]) 157 | /// NotifyChanged{T}(Expression{Func{T}}) 158 | /// NotifyChanged{T,U}(Expression{Func{T,U}}) 159 | /// SetProperty{T}(ref T, T, string) 160 | /// 161 | /// 162 | /// 163 | /// public class Foo : INotifyPropertyChanged { 164 | /// public event PropertyChangedEventHandler PropertyChanged; 165 | /// 166 | /// [NotifyPropertyChangedInvocator] 167 | /// protected virtual void NotifyChanged(string propertyName) { ... } 168 | /// 169 | /// string _name; 170 | /// 171 | /// public string Name { 172 | /// get { return _name; } 173 | /// set { _name = value; NotifyChanged("LastName"); /* Warning */ } 174 | /// } 175 | /// } 176 | /// 177 | /// Examples of generated notifications: 178 | /// 179 | /// NotifyChanged("Property") 180 | /// NotifyChanged(() => Property) 181 | /// NotifyChanged((VM x) => x.Property) 182 | /// SetProperty(ref myField, value, "Property") 183 | /// 184 | /// 185 | [AttributeUsage(AttributeTargets.Method)] 186 | public sealed class NotifyPropertyChangedInvocatorAttribute : Attribute 187 | { 188 | public NotifyPropertyChangedInvocatorAttribute() { } 189 | public NotifyPropertyChangedInvocatorAttribute([NotNull] string parameterName) 190 | { 191 | ParameterName = parameterName; 192 | } 193 | 194 | [CanBeNull] public string ParameterName { get; private set; } 195 | } 196 | 197 | /// 198 | /// Describes dependency between method input and output. 199 | /// 200 | /// 201 | ///

Function Definition Table syntax:

202 | /// 203 | /// FDT ::= FDTRow [;FDTRow]* 204 | /// FDTRow ::= Input => Output | Output <= Input 205 | /// Input ::= ParameterName: Value [, Input]* 206 | /// Output ::= [ParameterName: Value]* {halt|stop|void|nothing|Value} 207 | /// Value ::= true | false | null | notnull | canbenull 208 | /// 209 | /// If method has single input parameter, it's name could be omitted.
210 | /// Using halt (or void/nothing, which is the same) for method output 211 | /// means that the methos doesn't return normally (throws or terminates the process).
212 | /// Value canbenull is only applicable for output parameters.
213 | /// You can use multiple [ContractAnnotation] for each FDT row, or use single attribute 214 | /// with rows separated by semicolon. There is no notion of order rows, all rows are checked 215 | /// for applicability and applied per each program state tracked by R# analysis.
216 | ///
217 | /// 218 | /// 219 | /// [ContractAnnotation("=> halt")] 220 | /// public void TerminationMethod() 221 | /// 222 | /// 223 | /// [ContractAnnotation("halt <= condition: false")] 224 | /// public void Assert(bool condition, string text) // regular assertion method 225 | /// 226 | /// 227 | /// [ContractAnnotation("s:null => true")] 228 | /// public bool IsNullOrEmpty(string s) // string.IsNullOrEmpty() 229 | /// 230 | /// 231 | /// // A method that returns null if the parameter is null, 232 | /// // and not null if the parameter is not null 233 | /// [ContractAnnotation("null => null; notnull => notnull")] 234 | /// public object Transform(object data) 235 | /// 236 | /// 237 | /// [ContractAnnotation("=> true, result: notnull; => false, result: null")] 238 | /// public bool TryParse(string s, out Person result) 239 | /// 240 | /// 241 | [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] 242 | public sealed class ContractAnnotationAttribute : Attribute 243 | { 244 | public ContractAnnotationAttribute([NotNull] string contract) 245 | : this(contract, false) { } 246 | 247 | public ContractAnnotationAttribute([NotNull] string contract, bool forceFullStates) 248 | { 249 | Contract = contract; 250 | ForceFullStates = forceFullStates; 251 | } 252 | 253 | [NotNull] public string Contract { get; private set; } 254 | 255 | public bool ForceFullStates { get; private set; } 256 | } 257 | 258 | /// 259 | /// Indicates that marked element should be localized or not. 260 | /// 261 | /// 262 | /// [LocalizationRequiredAttribute(true)] 263 | /// class Foo { 264 | /// string str = "my string"; // Warning: Localizable string 265 | /// } 266 | /// 267 | [AttributeUsage(AttributeTargets.All)] 268 | public sealed class LocalizationRequiredAttribute : Attribute 269 | { 270 | public LocalizationRequiredAttribute() : this(true) { } 271 | 272 | public LocalizationRequiredAttribute(bool required) 273 | { 274 | Required = required; 275 | } 276 | 277 | public bool Required { get; private set; } 278 | } 279 | 280 | /// 281 | /// Indicates that the value of the marked type (or its derivatives) 282 | /// cannot be compared using '==' or '!=' operators and Equals() 283 | /// should be used instead. However, using '==' or '!=' for comparison 284 | /// with null is always permitted. 285 | /// 286 | /// 287 | /// [CannotApplyEqualityOperator] 288 | /// class NoEquality { } 289 | /// 290 | /// class UsesNoEquality { 291 | /// void Test() { 292 | /// var ca1 = new NoEquality(); 293 | /// var ca2 = new NoEquality(); 294 | /// if (ca1 != null) { // OK 295 | /// bool condition = ca1 == ca2; // Warning 296 | /// } 297 | /// } 298 | /// } 299 | /// 300 | [AttributeUsage(AttributeTargets.Interface | AttributeTargets.Class | AttributeTargets.Struct)] 301 | public sealed class CannotApplyEqualityOperatorAttribute : Attribute { } 302 | 303 | /// 304 | /// When applied to a target attribute, specifies a requirement for any type marked 305 | /// with the target attribute to implement or inherit specific type or types. 306 | /// 307 | /// 308 | /// [BaseTypeRequired(typeof(IComponent)] // Specify requirement 309 | /// class ComponentAttribute : Attribute { } 310 | /// 311 | /// [Component] // ComponentAttribute requires implementing IComponent interface 312 | /// class MyComponent : IComponent { } 313 | /// 314 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] 315 | [BaseTypeRequired(typeof(Attribute))] 316 | public sealed class BaseTypeRequiredAttribute : Attribute 317 | { 318 | public BaseTypeRequiredAttribute([NotNull] Type baseType) 319 | { 320 | BaseType = baseType; 321 | } 322 | 323 | [NotNull] public Type BaseType { get; private set; } 324 | } 325 | 326 | /// 327 | /// Indicates that the marked symbol is used implicitly (e.g. via reflection, in external library), 328 | /// so this symbol will not be marked as unused (as well as by other usage inspections). 329 | /// 330 | [AttributeUsage(AttributeTargets.All)] 331 | public sealed class UsedImplicitlyAttribute : Attribute 332 | { 333 | public UsedImplicitlyAttribute() 334 | : this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) { } 335 | 336 | public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags) 337 | : this(useKindFlags, ImplicitUseTargetFlags.Default) { } 338 | 339 | public UsedImplicitlyAttribute(ImplicitUseTargetFlags targetFlags) 340 | : this(ImplicitUseKindFlags.Default, targetFlags) { } 341 | 342 | public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags) 343 | { 344 | UseKindFlags = useKindFlags; 345 | TargetFlags = targetFlags; 346 | } 347 | 348 | public ImplicitUseKindFlags UseKindFlags { get; private set; } 349 | 350 | public ImplicitUseTargetFlags TargetFlags { get; private set; } 351 | } 352 | 353 | /// 354 | /// Should be used on attributes and causes ReSharper to not mark symbols marked with such attributes 355 | /// as unused (as well as by other usage inspections) 356 | /// 357 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.GenericParameter)] 358 | public sealed class MeansImplicitUseAttribute : Attribute 359 | { 360 | public MeansImplicitUseAttribute() 361 | : this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) { } 362 | 363 | public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags) 364 | : this(useKindFlags, ImplicitUseTargetFlags.Default) { } 365 | 366 | public MeansImplicitUseAttribute(ImplicitUseTargetFlags targetFlags) 367 | : this(ImplicitUseKindFlags.Default, targetFlags) { } 368 | 369 | public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags) 370 | { 371 | UseKindFlags = useKindFlags; 372 | TargetFlags = targetFlags; 373 | } 374 | 375 | [UsedImplicitly] public ImplicitUseKindFlags UseKindFlags { get; private set; } 376 | 377 | [UsedImplicitly] public ImplicitUseTargetFlags TargetFlags { get; private set; } 378 | } 379 | 380 | [Flags] 381 | public enum ImplicitUseKindFlags 382 | { 383 | Default = Access | Assign | InstantiatedWithFixedConstructorSignature, 384 | /// Only entity marked with attribute considered used. 385 | Access = 1, 386 | /// Indicates implicit assignment to a member. 387 | Assign = 2, 388 | /// 389 | /// Indicates implicit instantiation of a type with fixed constructor signature. 390 | /// That means any unused constructor parameters won't be reported as such. 391 | /// 392 | InstantiatedWithFixedConstructorSignature = 4, 393 | /// Indicates implicit instantiation of a type. 394 | InstantiatedNoFixedConstructorSignature = 8, 395 | } 396 | 397 | /// 398 | /// Specify what is considered used implicitly when marked 399 | /// with or . 400 | /// 401 | [Flags] 402 | public enum ImplicitUseTargetFlags 403 | { 404 | Default = Itself, 405 | Itself = 1, 406 | /// Members of entity marked with attribute are considered used. 407 | Members = 2, 408 | /// Entity marked with attribute and all its members considered used. 409 | WithMembers = Itself | Members 410 | } 411 | 412 | /// 413 | /// This attribute is intended to mark publicly available API 414 | /// which should not be removed and so is treated as used. 415 | /// 416 | [MeansImplicitUse(ImplicitUseTargetFlags.WithMembers)] 417 | public sealed class PublicAPIAttribute : Attribute 418 | { 419 | public PublicAPIAttribute() { } 420 | 421 | public PublicAPIAttribute([NotNull] string comment) 422 | { 423 | Comment = comment; 424 | } 425 | 426 | [CanBeNull] public string Comment { get; private set; } 427 | } 428 | 429 | /// 430 | /// Tells code analysis engine if the parameter is completely handled when the invoked method is on stack. 431 | /// If the parameter is a delegate, indicates that delegate is executed while the method is executed. 432 | /// If the parameter is an enumerable, indicates that it is enumerated while the method is executed. 433 | /// 434 | [AttributeUsage(AttributeTargets.Parameter)] 435 | public sealed class InstantHandleAttribute : Attribute { } 436 | 437 | /// 438 | /// Indicates that a method does not make any observable state changes. 439 | /// The same as System.Diagnostics.Contracts.PureAttribute. 440 | /// 441 | /// 442 | /// [Pure] int Multiply(int x, int y) => x * y; 443 | /// 444 | /// void M() { 445 | /// Multiply(123, 42); // Waring: Return value of pure method is not used 446 | /// } 447 | /// 448 | [AttributeUsage(AttributeTargets.Method)] 449 | public sealed class PureAttribute : Attribute { } 450 | 451 | /// 452 | /// Indicates that the return value of method invocation must be used. 453 | /// 454 | [AttributeUsage(AttributeTargets.Method)] 455 | public sealed class MustUseReturnValueAttribute : Attribute 456 | { 457 | public MustUseReturnValueAttribute() { } 458 | 459 | public MustUseReturnValueAttribute([NotNull] string justification) 460 | { 461 | Justification = justification; 462 | } 463 | 464 | [CanBeNull] public string Justification { get; private set; } 465 | } 466 | 467 | /// 468 | /// Indicates the type member or parameter of some type, that should be used instead of all other ways 469 | /// to get the value that type. This annotation is useful when you have some "context" value evaluated 470 | /// and stored somewhere, meaning that all other ways to get this value must be consolidated with existing one. 471 | /// 472 | /// 473 | /// class Foo { 474 | /// [ProvidesContext] IBarService _barService = ...; 475 | /// 476 | /// void ProcessNode(INode node) { 477 | /// DoSomething(node, node.GetGlobalServices().Bar); 478 | /// // ^ Warning: use value of '_barService' field 479 | /// } 480 | /// } 481 | /// 482 | [AttributeUsage( 483 | AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.Method | 484 | AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | AttributeTargets.GenericParameter)] 485 | public sealed class ProvidesContextAttribute : Attribute { } 486 | 487 | /// 488 | /// Indicates that a parameter is a path to a file or a folder within a web project. 489 | /// Path can be relative or absolute, starting from web root (~). 490 | /// 491 | [AttributeUsage(AttributeTargets.Parameter)] 492 | public sealed class PathReferenceAttribute : Attribute 493 | { 494 | public PathReferenceAttribute() { } 495 | 496 | public PathReferenceAttribute([NotNull, PathReference] string basePath) 497 | { 498 | BasePath = basePath; 499 | } 500 | 501 | [CanBeNull] public string BasePath { get; private set; } 502 | } 503 | 504 | /// 505 | /// An extension method marked with this attribute is processed by ReSharper code completion 506 | /// as a 'Source Template'. When extension method is completed over some expression, it's source code 507 | /// is automatically expanded like a template at call site. 508 | /// 509 | /// 510 | /// Template method body can contain valid source code and/or special comments starting with '$'. 511 | /// Text inside these comments is added as source code when the template is applied. Template parameters 512 | /// can be used either as additional method parameters or as identifiers wrapped in two '$' signs. 513 | /// Use the attribute to specify macros for parameters. 514 | /// 515 | /// 516 | /// In this example, the 'forEach' method is a source template available over all values 517 | /// of enumerable types, producing ordinary C# 'foreach' statement and placing caret inside block: 518 | /// 519 | /// [SourceTemplate] 520 | /// public static void forEach<T>(this IEnumerable<T> xs) { 521 | /// foreach (var x in xs) { 522 | /// //$ $END$ 523 | /// } 524 | /// } 525 | /// 526 | /// 527 | [AttributeUsage(AttributeTargets.Method)] 528 | public sealed class SourceTemplateAttribute : Attribute { } 529 | 530 | /// 531 | /// Allows specifying a macro for a parameter of a source template. 532 | /// 533 | /// 534 | /// You can apply the attribute on the whole method or on any of its additional parameters. The macro expression 535 | /// is defined in the property. When applied on a method, the target 536 | /// template parameter is defined in the property. To apply the macro silently 537 | /// for the parameter, set the property value = -1. 538 | /// 539 | /// 540 | /// Applying the attribute on a source template method: 541 | /// 542 | /// [SourceTemplate, Macro(Target = "item", Expression = "suggestVariableName()")] 543 | /// public static void forEach<T>(this IEnumerable<T> collection) { 544 | /// foreach (var item in collection) { 545 | /// //$ $END$ 546 | /// } 547 | /// } 548 | /// 549 | /// Applying the attribute on a template method parameter: 550 | /// 551 | /// [SourceTemplate] 552 | /// public static void something(this Entity x, [Macro(Expression = "guid()", Editable = -1)] string newguid) { 553 | /// /*$ var $x$Id = "$newguid$" + x.ToString(); 554 | /// x.DoSomething($x$Id); */ 555 | /// } 556 | /// 557 | /// 558 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method, AllowMultiple = true)] 559 | public sealed class MacroAttribute : Attribute 560 | { 561 | /// 562 | /// Allows specifying a macro that will be executed for a source template 563 | /// parameter when the template is expanded. 564 | /// 565 | [CanBeNull] public string Expression { get; set; } 566 | 567 | /// 568 | /// Allows specifying which occurrence of the target parameter becomes editable when the template is deployed. 569 | /// 570 | /// 571 | /// If the target parameter is used several times in the template, only one occurrence becomes editable; 572 | /// other occurrences are changed synchronously. To specify the zero-based index of the editable occurrence, 573 | /// use values >= 0. To make the parameter non-editable when the template is expanded, use -1. 574 | /// > 575 | public int Editable { get; set; } 576 | 577 | /// 578 | /// Identifies the target parameter of a source template if the 579 | /// is applied on a template method. 580 | /// 581 | [CanBeNull] public string Target { get; set; } 582 | } 583 | 584 | [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] 585 | public sealed class AspMvcAreaMasterLocationFormatAttribute : Attribute 586 | { 587 | public AspMvcAreaMasterLocationFormatAttribute([NotNull] string format) 588 | { 589 | Format = format; 590 | } 591 | 592 | [NotNull] public string Format { get; private set; } 593 | } 594 | 595 | [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] 596 | public sealed class AspMvcAreaPartialViewLocationFormatAttribute : Attribute 597 | { 598 | public AspMvcAreaPartialViewLocationFormatAttribute([NotNull] string format) 599 | { 600 | Format = format; 601 | } 602 | 603 | [NotNull] public string Format { get; private set; } 604 | } 605 | 606 | [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] 607 | public sealed class AspMvcAreaViewLocationFormatAttribute : Attribute 608 | { 609 | public AspMvcAreaViewLocationFormatAttribute([NotNull] string format) 610 | { 611 | Format = format; 612 | } 613 | 614 | [NotNull] public string Format { get; private set; } 615 | } 616 | 617 | [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] 618 | public sealed class AspMvcMasterLocationFormatAttribute : Attribute 619 | { 620 | public AspMvcMasterLocationFormatAttribute([NotNull] string format) 621 | { 622 | Format = format; 623 | } 624 | 625 | [NotNull] public string Format { get; private set; } 626 | } 627 | 628 | [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] 629 | public sealed class AspMvcPartialViewLocationFormatAttribute : Attribute 630 | { 631 | public AspMvcPartialViewLocationFormatAttribute([NotNull] string format) 632 | { 633 | Format = format; 634 | } 635 | 636 | [NotNull] public string Format { get; private set; } 637 | } 638 | 639 | [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] 640 | public sealed class AspMvcViewLocationFormatAttribute : Attribute 641 | { 642 | public AspMvcViewLocationFormatAttribute([NotNull] string format) 643 | { 644 | Format = format; 645 | } 646 | 647 | [NotNull] public string Format { get; private set; } 648 | } 649 | 650 | /// 651 | /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter 652 | /// is an MVC action. If applied to a method, the MVC action name is calculated 653 | /// implicitly from the context. Use this attribute for custom wrappers similar to 654 | /// System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String). 655 | /// 656 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)] 657 | public sealed class AspMvcActionAttribute : Attribute 658 | { 659 | public AspMvcActionAttribute() { } 660 | 661 | public AspMvcActionAttribute([NotNull] string anonymousProperty) 662 | { 663 | AnonymousProperty = anonymousProperty; 664 | } 665 | 666 | [CanBeNull] public string AnonymousProperty { get; private set; } 667 | } 668 | 669 | /// 670 | /// ASP.NET MVC attribute. Indicates that a parameter is an MVC area. 671 | /// Use this attribute for custom wrappers similar to 672 | /// System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String). 673 | /// 674 | [AttributeUsage(AttributeTargets.Parameter)] 675 | public sealed class AspMvcAreaAttribute : Attribute 676 | { 677 | public AspMvcAreaAttribute() { } 678 | 679 | public AspMvcAreaAttribute([NotNull] string anonymousProperty) 680 | { 681 | AnonymousProperty = anonymousProperty; 682 | } 683 | 684 | [CanBeNull] public string AnonymousProperty { get; private set; } 685 | } 686 | 687 | /// 688 | /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is 689 | /// an MVC controller. If applied to a method, the MVC controller name is calculated 690 | /// implicitly from the context. Use this attribute for custom wrappers similar to 691 | /// System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String, String). 692 | /// 693 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)] 694 | public sealed class AspMvcControllerAttribute : Attribute 695 | { 696 | public AspMvcControllerAttribute() { } 697 | 698 | public AspMvcControllerAttribute([NotNull] string anonymousProperty) 699 | { 700 | AnonymousProperty = anonymousProperty; 701 | } 702 | 703 | [CanBeNull] public string AnonymousProperty { get; private set; } 704 | } 705 | 706 | /// 707 | /// ASP.NET MVC attribute. Indicates that a parameter is an MVC Master. Use this attribute 708 | /// for custom wrappers similar to System.Web.Mvc.Controller.View(String, String). 709 | /// 710 | [AttributeUsage(AttributeTargets.Parameter)] 711 | public sealed class AspMvcMasterAttribute : Attribute { } 712 | 713 | /// 714 | /// ASP.NET MVC attribute. Indicates that a parameter is an MVC model type. Use this attribute 715 | /// for custom wrappers similar to System.Web.Mvc.Controller.View(String, Object). 716 | /// 717 | [AttributeUsage(AttributeTargets.Parameter)] 718 | public sealed class AspMvcModelTypeAttribute : Attribute { } 719 | 720 | /// 721 | /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is an MVC 722 | /// partial view. If applied to a method, the MVC partial view name is calculated implicitly 723 | /// from the context. Use this attribute for custom wrappers similar to 724 | /// System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper, String). 725 | /// 726 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)] 727 | public sealed class AspMvcPartialViewAttribute : Attribute { } 728 | 729 | /// 730 | /// ASP.NET MVC attribute. Allows disabling inspections for MVC views within a class or a method. 731 | /// 732 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] 733 | public sealed class AspMvcSuppressViewErrorAttribute : Attribute { } 734 | 735 | /// 736 | /// ASP.NET MVC attribute. Indicates that a parameter is an MVC display template. 737 | /// Use this attribute for custom wrappers similar to 738 | /// System.Web.Mvc.Html.DisplayExtensions.DisplayForModel(HtmlHelper, String). 739 | /// 740 | [AttributeUsage(AttributeTargets.Parameter)] 741 | public sealed class AspMvcDisplayTemplateAttribute : Attribute { } 742 | 743 | /// 744 | /// ASP.NET MVC attribute. Indicates that a parameter is an MVC editor template. 745 | /// Use this attribute for custom wrappers similar to 746 | /// System.Web.Mvc.Html.EditorExtensions.EditorForModel(HtmlHelper, String). 747 | /// 748 | [AttributeUsage(AttributeTargets.Parameter)] 749 | public sealed class AspMvcEditorTemplateAttribute : Attribute { } 750 | 751 | /// 752 | /// ASP.NET MVC attribute. Indicates that a parameter is an MVC template. 753 | /// Use this attribute for custom wrappers similar to 754 | /// System.ComponentModel.DataAnnotations.UIHintAttribute(System.String). 755 | /// 756 | [AttributeUsage(AttributeTargets.Parameter)] 757 | public sealed class AspMvcTemplateAttribute : Attribute { } 758 | 759 | /// 760 | /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter 761 | /// is an MVC view component. If applied to a method, the MVC view name is calculated implicitly 762 | /// from the context. Use this attribute for custom wrappers similar to 763 | /// System.Web.Mvc.Controller.View(Object). 764 | /// 765 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)] 766 | public sealed class AspMvcViewAttribute : Attribute { } 767 | 768 | /// 769 | /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter 770 | /// is an MVC view component name. 771 | /// 772 | [AttributeUsage(AttributeTargets.Parameter)] 773 | public sealed class AspMvcViewComponentAttribute : Attribute { } 774 | 775 | /// 776 | /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter 777 | /// is an MVC view component view. If applied to a method, the MVC view component view name is default. 778 | /// 779 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)] 780 | public sealed class AspMvcViewComponentViewAttribute : Attribute { } 781 | 782 | /// 783 | /// ASP.NET MVC attribute. When applied to a parameter of an attribute, 784 | /// indicates that this parameter is an MVC action name. 785 | /// 786 | /// 787 | /// [ActionName("Foo")] 788 | /// public ActionResult Login(string returnUrl) { 789 | /// ViewBag.ReturnUrl = Url.Action("Foo"); // OK 790 | /// return RedirectToAction("Bar"); // Error: Cannot resolve action 791 | /// } 792 | /// 793 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property)] 794 | public sealed class AspMvcActionSelectorAttribute : Attribute { } 795 | 796 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field)] 797 | public sealed class HtmlElementAttributesAttribute : Attribute 798 | { 799 | public HtmlElementAttributesAttribute() { } 800 | 801 | public HtmlElementAttributesAttribute([NotNull] string name) 802 | { 803 | Name = name; 804 | } 805 | 806 | [CanBeNull] public string Name { get; private set; } 807 | } 808 | 809 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] 810 | public sealed class HtmlAttributeValueAttribute : Attribute 811 | { 812 | public HtmlAttributeValueAttribute([NotNull] string name) 813 | { 814 | Name = name; 815 | } 816 | 817 | [NotNull] public string Name { get; private set; } 818 | } 819 | 820 | /// 821 | /// Razor attribute. Indicates that a parameter or a method is a Razor section. 822 | /// Use this attribute for custom wrappers similar to 823 | /// System.Web.WebPages.WebPageBase.RenderSection(String). 824 | /// 825 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)] 826 | public sealed class RazorSectionAttribute : Attribute { } 827 | 828 | /// 829 | /// Indicates how method, constructor invocation or property access 830 | /// over collection type affects content of the collection. 831 | /// 832 | [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Property)] 833 | public sealed class CollectionAccessAttribute : Attribute 834 | { 835 | public CollectionAccessAttribute(CollectionAccessType collectionAccessType) 836 | { 837 | CollectionAccessType = collectionAccessType; 838 | } 839 | 840 | public CollectionAccessType CollectionAccessType { get; private set; } 841 | } 842 | 843 | [Flags] 844 | public enum CollectionAccessType 845 | { 846 | /// Method does not use or modify content of the collection. 847 | None = 0, 848 | /// Method only reads content of the collection but does not modify it. 849 | Read = 1, 850 | /// Method can change content of the collection but does not add new elements. 851 | ModifyExistingContent = 2, 852 | /// Method can add new elements to the collection. 853 | UpdatedContent = ModifyExistingContent | 4 854 | } 855 | 856 | /// 857 | /// Indicates that the marked method is assertion method, i.e. it halts control flow if 858 | /// one of the conditions is satisfied. To set the condition, mark one of the parameters with 859 | /// attribute. 860 | /// 861 | [AttributeUsage(AttributeTargets.Method)] 862 | public sealed class AssertionMethodAttribute : Attribute { } 863 | 864 | /// 865 | /// Indicates the condition parameter of the assertion method. The method itself should be 866 | /// marked by attribute. The mandatory argument of 867 | /// the attribute is the assertion type. 868 | /// 869 | [AttributeUsage(AttributeTargets.Parameter)] 870 | public sealed class AssertionConditionAttribute : Attribute 871 | { 872 | public AssertionConditionAttribute(AssertionConditionType conditionType) 873 | { 874 | ConditionType = conditionType; 875 | } 876 | 877 | public AssertionConditionType ConditionType { get; private set; } 878 | } 879 | 880 | /// 881 | /// Specifies assertion type. If the assertion method argument satisfies the condition, 882 | /// then the execution continues. Otherwise, execution is assumed to be halted. 883 | /// 884 | public enum AssertionConditionType 885 | { 886 | /// Marked parameter should be evaluated to true. 887 | IS_TRUE = 0, 888 | /// Marked parameter should be evaluated to false. 889 | IS_FALSE = 1, 890 | /// Marked parameter should be evaluated to null value. 891 | IS_NULL = 2, 892 | /// Marked parameter should be evaluated to not null value. 893 | IS_NOT_NULL = 3, 894 | } 895 | 896 | /// 897 | /// Indicates that the marked method unconditionally terminates control flow execution. 898 | /// For example, it could unconditionally throw exception. 899 | /// 900 | [Obsolete("Use [ContractAnnotation('=> halt')] instead")] 901 | [AttributeUsage(AttributeTargets.Method)] 902 | public sealed class TerminatesProgramAttribute : Attribute { } 903 | 904 | /// 905 | /// Indicates that method is pure LINQ method, with postponed enumeration (like Enumerable.Select, 906 | /// .Where). This annotation allows inference of [InstantHandle] annotation for parameters 907 | /// of delegate type by analyzing LINQ method chains. 908 | /// 909 | [AttributeUsage(AttributeTargets.Method)] 910 | public sealed class LinqTunnelAttribute : Attribute { } 911 | 912 | /// 913 | /// Indicates that IEnumerable, passed as parameter, is not enumerated. 914 | /// 915 | [AttributeUsage(AttributeTargets.Parameter)] 916 | public sealed class NoEnumerationAttribute : Attribute { } 917 | 918 | /// 919 | /// Indicates that parameter is regular expression pattern. 920 | /// 921 | [AttributeUsage(AttributeTargets.Parameter)] 922 | public sealed class RegexPatternAttribute : Attribute { } 923 | 924 | /// 925 | /// Prevents the Member Reordering feature from tossing members of the marked class. 926 | /// 927 | /// 928 | /// The attribute must be mentioned in your member reordering patterns 929 | /// 930 | [AttributeUsage( 931 | AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | AttributeTargets.Enum)] 932 | public sealed class NoReorderAttribute : Attribute { } 933 | 934 | /// 935 | /// XAML attribute. Indicates the type that has ItemsSource property and should be treated 936 | /// as ItemsControl-derived type, to enable inner items DataContext type resolve. 937 | /// 938 | [AttributeUsage(AttributeTargets.Class)] 939 | public sealed class XamlItemsControlAttribute : Attribute { } 940 | 941 | /// 942 | /// XAML attribute. Indicates the property of some BindingBase-derived type, that 943 | /// is used to bind some item of ItemsControl-derived type. This annotation will 944 | /// enable the DataContext type resolve for XAML bindings for such properties. 945 | /// 946 | /// 947 | /// Property should have the tree ancestor of the ItemsControl type or 948 | /// marked with the attribute. 949 | /// 950 | [AttributeUsage(AttributeTargets.Property)] 951 | public sealed class XamlItemBindingOfItemsControlAttribute : Attribute { } 952 | 953 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] 954 | public sealed class AspChildControlTypeAttribute : Attribute 955 | { 956 | public AspChildControlTypeAttribute([NotNull] string tagName, [NotNull] Type controlType) 957 | { 958 | TagName = tagName; 959 | ControlType = controlType; 960 | } 961 | 962 | [NotNull] public string TagName { get; private set; } 963 | 964 | [NotNull] public Type ControlType { get; private set; } 965 | } 966 | 967 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)] 968 | public sealed class AspDataFieldAttribute : Attribute { } 969 | 970 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)] 971 | public sealed class AspDataFieldsAttribute : Attribute { } 972 | 973 | [AttributeUsage(AttributeTargets.Property)] 974 | public sealed class AspMethodPropertyAttribute : Attribute { } 975 | 976 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] 977 | public sealed class AspRequiredAttributeAttribute : Attribute 978 | { 979 | public AspRequiredAttributeAttribute([NotNull] string attribute) 980 | { 981 | Attribute = attribute; 982 | } 983 | 984 | [NotNull] public string Attribute { get; private set; } 985 | } 986 | 987 | [AttributeUsage(AttributeTargets.Property)] 988 | public sealed class AspTypePropertyAttribute : Attribute 989 | { 990 | public bool CreateConstructorReferences { get; private set; } 991 | 992 | public AspTypePropertyAttribute(bool createConstructorReferences) 993 | { 994 | CreateConstructorReferences = createConstructorReferences; 995 | } 996 | } 997 | 998 | [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] 999 | public sealed class RazorImportNamespaceAttribute : Attribute 1000 | { 1001 | public RazorImportNamespaceAttribute([NotNull] string name) 1002 | { 1003 | Name = name; 1004 | } 1005 | 1006 | [NotNull] public string Name { get; private set; } 1007 | } 1008 | 1009 | [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] 1010 | public sealed class RazorInjectionAttribute : Attribute 1011 | { 1012 | public RazorInjectionAttribute([NotNull] string type, [NotNull] string fieldName) 1013 | { 1014 | Type = type; 1015 | FieldName = fieldName; 1016 | } 1017 | 1018 | [NotNull] public string Type { get; private set; } 1019 | 1020 | [NotNull] public string FieldName { get; private set; } 1021 | } 1022 | 1023 | [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] 1024 | public sealed class RazorDirectiveAttribute : Attribute 1025 | { 1026 | public RazorDirectiveAttribute([NotNull] string directive) 1027 | { 1028 | Directive = directive; 1029 | } 1030 | 1031 | [NotNull] public string Directive { get; private set; } 1032 | } 1033 | 1034 | [AttributeUsage(AttributeTargets.Method)] 1035 | public sealed class RazorHelperCommonAttribute : Attribute { } 1036 | 1037 | [AttributeUsage(AttributeTargets.Property)] 1038 | public sealed class RazorLayoutAttribute : Attribute { } 1039 | 1040 | [AttributeUsage(AttributeTargets.Method)] 1041 | public sealed class RazorWriteLiteralMethodAttribute : Attribute { } 1042 | 1043 | [AttributeUsage(AttributeTargets.Method)] 1044 | public sealed class RazorWriteMethodAttribute : Attribute { } 1045 | 1046 | [AttributeUsage(AttributeTargets.Parameter)] 1047 | public sealed class RazorWriteMethodParameterAttribute : Attribute { } 1048 | } -------------------------------------------------------------------------------- /XamlDisplayer/Demo/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [assembly: AssemblyTitle("DisplayXamlDemo")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("Microsoft")] 14 | [assembly: AssemblyProduct("DisplayXamlDemo_MaterialDesignXamlLibrary")] 15 | [assembly: AssemblyCopyright("Copyright © Microsoft 2017")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // Setting ComVisible to false makes the types in this assembly not visible 20 | // to COM components. If you need to access a type in this assembly from 21 | // COM, set the ComVisible attribute to true on that type. 22 | [assembly: ComVisible(false)] 23 | 24 | //In order to begin building localizable applications, set 25 | //CultureYouAreCodingWith in your .csproj file 26 | //inside a . For example, if you are using US english 27 | //in your source files, set the to en-US. Then uncomment 28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 29 | //the line below to match the UICulture setting in the project file. 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly: ThemeInfo( 35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 36 | //(used if a resource is not found in the page, 37 | // or application resource dictionaries) 38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 39 | //(used if a resource is not found in the page, 40 | // app, or any theme specific resource dictionaries) 41 | )] 42 | 43 | 44 | // Version information for an assembly consists of the following four values: 45 | // 46 | // Major Version 47 | // Minor Version 48 | // Build Number 49 | // Revision 50 | // 51 | // You can specify all the values or you can default the Build and Revision Numbers 52 | // by using the '*' as shown below: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("1.0.0.0")] 55 | [assembly: AssemblyFileVersion("1.0.0.0")] 56 | -------------------------------------------------------------------------------- /XamlDisplayer/Demo/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace XamlDisplayerDemo.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("XamlDisplayerDemo.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /XamlDisplayer/Demo/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /XamlDisplayer/Demo/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace XamlDisplayerDemo.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.1.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /XamlDisplayer/Demo/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /XamlDisplayer/Demo/XamlDisplayerDemo.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {2F111882-6FA5-4FE8-8826-766EB33118F2} 8 | WinExe 9 | Properties 10 | XamlDisplayerDemo 11 | XamlDisplayerDemo 12 | v4.5.2 13 | 512 14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 15 | 4 16 | true 17 | 18 | 19 | 20 | 21 | AnyCPU 22 | true 23 | full 24 | false 25 | bin\Debug\ 26 | DEBUG;TRACE 27 | prompt 28 | 4 29 | 30 | 31 | AnyCPU 32 | pdbonly 33 | true 34 | bin\Release\ 35 | TRACE 36 | prompt 37 | 4 38 | 39 | 40 | DisplayXamlDemo.App 41 | 42 | 43 | 44 | ..\packages\Costura.Fody.1.6.2\lib\dotnet\Costura.dll 45 | False 46 | 47 | 48 | ..\packages\AvalonEdit.5.0.3\lib\Net40\ICSharpCode.AvalonEdit.dll 49 | True 50 | 51 | 52 | ..\packages\MaterialDesignColors.1.1.2\lib\net45\MaterialDesignColors.dll 53 | 54 | 55 | ..\packages\MaterialDesignThemes.2.3.0.823\lib\net45\MaterialDesignThemes.Wpf.dll 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 4.0 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | MSBuild:Compile 75 | Designer 76 | 77 | 78 | MSBuild:Compile 79 | Designer 80 | 81 | 82 | App.xaml 83 | Code 84 | 85 | 86 | MainWindow.xaml 87 | Code 88 | 89 | 90 | Designer 91 | MSBuild:Compile 92 | 93 | 94 | 95 | 96 | Page1.xaml 97 | 98 | 99 | 100 | Code 101 | 102 | 103 | True 104 | True 105 | Resources.resx 106 | 107 | 108 | True 109 | Settings.settings 110 | True 111 | 112 | 113 | ResXFileCodeGenerator 114 | Resources.Designer.cs 115 | 116 | 117 | 118 | SettingsSingleFileGenerator 119 | Settings.Designer.cs 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | {ab0aca42-1c9f-4823-a8c9-4594c5b70f4e} 135 | CodeDisplayer 136 | 137 | 138 | 139 | 140 | 141 | 142 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 143 | 144 | 145 | 146 | 147 | 148 | 155 | -------------------------------------------------------------------------------- /XamlDisplayer/Demo/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /XamlDisplayer/DisplayXamlDemo.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26430.14 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XamlDisplayerDemo", "Demo\XamlDisplayerDemo.csproj", "{2F111882-6FA5-4FE8-8826-766EB33118F2}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeDisplayer", "CodeDisplayer\CodeDisplayer.csproj", "{AB0ACA42-1C9F-4823-A8C9-4594C5B70F4E}" 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 | {2F111882-6FA5-4FE8-8826-766EB33118F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {2F111882-6FA5-4FE8-8826-766EB33118F2}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {2F111882-6FA5-4FE8-8826-766EB33118F2}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {2F111882-6FA5-4FE8-8826-766EB33118F2}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {AB0ACA42-1C9F-4823-A8C9-4594C5B70F4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {AB0ACA42-1C9F-4823-A8C9-4594C5B70F4E}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {AB0ACA42-1C9F-4823-A8C9-4594C5B70F4E}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {AB0ACA42-1C9F-4823-A8C9-4594C5B70F4E}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /XamlDisplayer/DisplayXamlDemo.sln.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | True -------------------------------------------------------------------------------- /XamlDisplayer/Package.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | XamlDisplayerPackage 5 | 1.0.6 6 | WJHau 7 | WJHau 8 | https://github.com/wongjiahau/Displaying-XAML/blob/master/LICENSE 9 | https://github.com/wongjiahau/Displaying-XAML 10 | https://raw.githubusercontent.com/wongjiahau/Displaying-XAML/master/icon.png 11 | false 12 | This is a code displaying tool for themes library in WPF 13 | Remove unnecessary frame, fixing Material Design In XAML demo 14 | Changelog can be found below : 15 | https://github.com/wongjiahau/Displaying-XAML/blob/master/XamlDisplayer/CodeDisplayer/Changelog.md 16 | 17 | WJHau Copyright 2017 18 | WPF Theme-Library 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wongjiahau/Displaying-XAML/5701c21049d4cbac24def1df4f0851634582c83c/icon.png --------------------------------------------------------------------------------