├── .github
├── FUNDING.yml
├── dependabot.yml
└── workflows
│ └── build.yaml
├── .gitignore
├── Directory.Build.props
├── LICENSE
├── README.md
├── art
├── ProXamlToolbox.pdn
├── ProXamlToolbox.png
├── WPFToolBox.png
├── WPFToolBox96.png
└── screenshot-darkandlight.png
├── nuget.config
└── src
├── .editorconfig
├── ProXamlToolbox.Tests
├── InsertLogicTests.cs
├── ProXamlToolbox.Tests.csproj
└── Properties
│ └── AssemblyInfo.cs
├── ProXamlToolbox.lutconfig
├── ProXamlToolbox.sln
└── ProXamlToolbox
├── AnalyticsConfig.cs
├── InsertLogic.cs
├── Key.snk
├── LICENSE.txt
├── OutputPane.cs
├── ProToolboxItem.cs
├── ProXamlToolbox.csproj
├── ProXamlToolboxWindow.cs
├── ProXamlToolboxWindowCommand.cs
├── ProXamlToolboxWindowControl.xaml
├── ProXamlToolboxWindowControl.xaml.cs
├── ProXamlToolboxWindowPackage.cs
├── ProXamlToolboxWindowPackage.vsct
├── ProXamlToolboxWindowPackage1.cs
├── Properties
└── AssemblyInfo.cs
├── Resources
├── ProXamlToolbox.png
├── ProXamlToolboxWindowCommand.png
└── ProXamlToolboxWindowPackage.ico
├── TargetPlatform.cs
├── ToolboxSettings.cs
├── ToolboxViewModel.cs
├── VSPackage.resx
├── filestosign.txt
├── signvsix.targets
├── source.extension.cs
└── source.extension.vsixmanifest
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: mrlacey # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
14 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | # To get started with Dependabot version updates, you'll need to specify which
2 | # package ecosystems to update and where the package manifests are located.
3 | # Please see the documentation for all configuration options:
4 | # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5 |
6 | version: 2
7 | updates:
8 | - package-ecosystem: "" # See documentation for possible values
9 | directory: "/" # Location of package manifests
10 | schedule:
11 | interval: "weekly"
12 |
--------------------------------------------------------------------------------
/.github/workflows/build.yaml:
--------------------------------------------------------------------------------
1 | # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2 | name: "Build"
3 |
4 | on:
5 | push:
6 | branches: [main]
7 | paths-ignore:
8 | - '*.md'
9 | pull_request:
10 | branches: [main]
11 | paths-ignore:
12 | - '*.md'
13 |
14 | jobs:
15 | build:
16 | outputs:
17 | version: ${{ steps.vsix_version.outputs.version-number }}
18 | name: Build
19 | runs-on: windows-2022
20 |
21 | permissions:
22 | checks: write
23 |
24 | # needed unless run with comment_mode: off
25 | pull-requests: write
26 |
27 | env:
28 | Configuration: Debug
29 | DeployExtension: False
30 | VsixManifestPath: src\ProXamlToolbox\source.extension.vsixmanifest
31 | VsixManifestSourcePath: src\ProXamlToolbox\source.extension.cs
32 |
33 | steps:
34 | - uses: actions/checkout@v4
35 |
36 | - name: Setup .NET build dependencies
37 | uses: timheuer/bootstrap-dotnet@v2
38 | with:
39 | nuget: 'false'
40 | sdk: 'false'
41 | msbuild: 'true'
42 |
43 | - name: Increment VSIX version
44 | id: vsix_version
45 | uses: timheuer/vsix-version-stamp@v2
46 | with:
47 | manifest-file: ${{ env.VsixManifestPath }}
48 | vsix-token-source-file: ${{ env.VsixManifestSourcePath }}
49 |
50 | - name: Build
51 | run: msbuild /v:m -restore /p:OutDir=\_built ./src/ProXamlToolbox.sln
52 |
53 | - name: Upload artifact
54 | uses: actions/upload-artifact@v4
55 | with:
56 | name: ${{ github.event.repository.name }}.vsix
57 | path: /_built/**/*.vsix
58 |
59 | - name: Run Tests
60 | # See https://github.com/microsoft/vstest-action/issues/31
61 | # uses: microsoft/vstest-action@v1.0.0
62 | uses: josepho0918/vstest-action@main
63 | with:
64 | searchFolder: /_built/
65 | testAssembly: /**/*Tests.dll
66 |
67 | - name: Publish Test Results
68 | uses: EnricoMi/publish-unit-test-result-action/windows@v2
69 | id: test-results
70 | with:
71 | files: testresults\**\*.trx
72 |
73 | - name: Set badge color
74 | shell: bash
75 | run: |
76 | case ${{ fromJSON( steps.test-results.outputs.json ).conclusion }} in
77 | success)
78 | echo "BADGE_COLOR=31c653" >> $GITHUB_ENV
79 | ;;
80 | failure)
81 | echo "BADGE_COLOR=800000" >> $GITHUB_ENV
82 | ;;
83 | neutral)
84 | echo "BADGE_COLOR=696969" >> $GITHUB_ENV
85 | ;;
86 | esac
87 |
88 | - name: Create badge
89 | uses: emibcn/badge-action@808173dd03e2f30c980d03ee49e181626088eee8
90 | with:
91 | label: Tests
92 | status: '${{ fromJSON( steps.test-results.outputs.json ).formatted.stats.tests }} tests: ${{ fromJSON( steps.test-results.outputs.json ).conclusion }}'
93 | color: ${{ env.BADGE_COLOR }}
94 | path: ProXamlToolbox.badge.svg
95 |
96 | - name: Upload badge to Gist
97 | # Upload only for main branch
98 | if: >
99 | github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'main' ||
100 | github.event_name != 'workflow_run' && github.ref == 'refs/heads/main'
101 | uses: jpontdia/append-gist-action@master
102 | with:
103 | token: ${{ secrets.GIST_TOKEN }}
104 | gistURL: https://gist.githubusercontent.com/mrlacey/c586ff0f495b4a8dd76ab0dbdf9c89e0
105 | file: ProXamlToolbox.badge.svg
106 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Ww][Ii][Nn]32/
27 | [Aa][Rr][Mm]/
28 | [Aa][Rr][Mm]64/
29 | bld/
30 | [Bb]in/
31 | [Oo]bj/
32 | [Ll]og/
33 | [Ll]ogs/
34 |
35 | # Visual Studio 2015/2017 cache/options directory
36 | .vs/
37 | # Uncomment if you have tasks that create the project's static files in wwwroot
38 | #wwwroot/
39 |
40 | # Visual Studio 2017 auto generated files
41 | Generated\ Files/
42 |
43 | # MSTest test Results
44 | [Tt]est[Rr]esult*/
45 | [Bb]uild[Ll]og.*
46 |
47 | # NUnit
48 | *.VisualState.xml
49 | TestResult.xml
50 | nunit-*.xml
51 |
52 | # Build Results of an ATL Project
53 | [Dd]ebugPS/
54 | [Rr]eleasePS/
55 | dlldata.c
56 |
57 | # Benchmark Results
58 | BenchmarkDotNet.Artifacts/
59 |
60 | # .NET Core
61 | project.lock.json
62 | project.fragment.lock.json
63 | artifacts/
64 |
65 | # ASP.NET Scaffolding
66 | ScaffoldingReadMe.txt
67 |
68 | # StyleCop
69 | StyleCopReport.xml
70 |
71 | # Files built by Visual Studio
72 | *_i.c
73 | *_p.c
74 | *_h.h
75 | *.ilk
76 | *.meta
77 | *.obj
78 | *.iobj
79 | *.pch
80 | *.pdb
81 | *.ipdb
82 | *.pgc
83 | *.pgd
84 | *.rsp
85 | *.sbr
86 | *.tlb
87 | *.tli
88 | *.tlh
89 | *.tmp
90 | *.tmp_proj
91 | *_wpftmp.csproj
92 | *.log
93 | *.tlog
94 | *.vspscc
95 | *.vssscc
96 | .builds
97 | *.pidb
98 | *.svclog
99 | *.scc
100 |
101 | # Chutzpah Test files
102 | _Chutzpah*
103 |
104 | # Visual C++ cache files
105 | ipch/
106 | *.aps
107 | *.ncb
108 | *.opendb
109 | *.opensdf
110 | *.sdf
111 | *.cachefile
112 | *.VC.db
113 | *.VC.VC.opendb
114 |
115 | # Visual Studio profiler
116 | *.psess
117 | *.vsp
118 | *.vspx
119 | *.sap
120 |
121 | # Visual Studio Trace Files
122 | *.e2e
123 |
124 | # TFS 2012 Local Workspace
125 | $tf/
126 |
127 | # Guidance Automation Toolkit
128 | *.gpState
129 |
130 | # ReSharper is a .NET coding add-in
131 | _ReSharper*/
132 | *.[Rr]e[Ss]harper
133 | *.DotSettings.user
134 |
135 | # TeamCity is a build add-in
136 | _TeamCity*
137 |
138 | # DotCover is a Code Coverage Tool
139 | *.dotCover
140 |
141 | # AxoCover is a Code Coverage Tool
142 | .axoCover/*
143 | !.axoCover/settings.json
144 |
145 | # Coverlet is a free, cross platform Code Coverage Tool
146 | coverage*.json
147 | coverage*.xml
148 | coverage*.info
149 |
150 | # Visual Studio code coverage results
151 | *.coverage
152 | *.coveragexml
153 |
154 | # NCrunch
155 | _NCrunch_*
156 | .*crunch*.local.xml
157 | nCrunchTemp_*
158 |
159 | # MightyMoose
160 | *.mm.*
161 | AutoTest.Net/
162 |
163 | # Web workbench (sass)
164 | .sass-cache/
165 |
166 | # Installshield output folder
167 | [Ee]xpress/
168 |
169 | # DocProject is a documentation generator add-in
170 | DocProject/buildhelp/
171 | DocProject/Help/*.HxT
172 | DocProject/Help/*.HxC
173 | DocProject/Help/*.hhc
174 | DocProject/Help/*.hhk
175 | DocProject/Help/*.hhp
176 | DocProject/Help/Html2
177 | DocProject/Help/html
178 |
179 | # Click-Once directory
180 | publish/
181 |
182 | # Publish Web Output
183 | *.[Pp]ublish.xml
184 | *.azurePubxml
185 | # Note: Comment the next line if you want to checkin your web deploy settings,
186 | # but database connection strings (with potential passwords) will be unencrypted
187 | *.pubxml
188 | *.publishproj
189 |
190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
191 | # checkin your Azure Web App publish settings, but sensitive information contained
192 | # in these scripts will be unencrypted
193 | PublishScripts/
194 |
195 | # NuGet Packages
196 | *.nupkg
197 | # NuGet Symbol Packages
198 | *.snupkg
199 | # The packages folder can be ignored because of Package Restore
200 | **/[Pp]ackages/*
201 | # except build/, which is used as an MSBuild target.
202 | !**/[Pp]ackages/build/
203 | # Uncomment if necessary however generally it will be regenerated when needed
204 | #!**/[Pp]ackages/repositories.config
205 | # NuGet v3's project.json files produces more ignorable files
206 | *.nuget.props
207 | *.nuget.targets
208 |
209 | # Microsoft Azure Build Output
210 | csx/
211 | *.build.csdef
212 |
213 | # Microsoft Azure Emulator
214 | ecf/
215 | rcf/
216 |
217 | # Windows Store app package directories and files
218 | AppPackages/
219 | BundleArtifacts/
220 | Package.StoreAssociation.xml
221 | _pkginfo.txt
222 | *.appx
223 | *.appxbundle
224 | *.appxupload
225 |
226 | # Visual Studio cache files
227 | # files ending in .cache can be ignored
228 | *.[Cc]ache
229 | # but keep track of directories ending in .cache
230 | !?*.[Cc]ache/
231 |
232 | # Others
233 | ClientBin/
234 | ~$*
235 | *~
236 | *.dbmdl
237 | *.dbproj.schemaview
238 | *.jfm
239 | *.pfx
240 | *.publishsettings
241 | orleans.codegen.cs
242 |
243 | # Including strong name files can present a security risk
244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
245 | #*.snk
246 |
247 | # Since there are multiple workflows, uncomment next line to ignore bower_components
248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
249 | #bower_components/
250 |
251 | # RIA/Silverlight projects
252 | Generated_Code/
253 |
254 | # Backup & report files from converting an old project file
255 | # to a newer Visual Studio version. Backup files are not needed,
256 | # because we have git ;-)
257 | _UpgradeReport_Files/
258 | Backup*/
259 | UpgradeLog*.XML
260 | UpgradeLog*.htm
261 | ServiceFabricBackup/
262 | *.rptproj.bak
263 |
264 | # SQL Server files
265 | *.mdf
266 | *.ldf
267 | *.ndf
268 |
269 | # Business Intelligence projects
270 | *.rdl.data
271 | *.bim.layout
272 | *.bim_*.settings
273 | *.rptproj.rsuser
274 | *- [Bb]ackup.rdl
275 | *- [Bb]ackup ([0-9]).rdl
276 | *- [Bb]ackup ([0-9][0-9]).rdl
277 |
278 | # Microsoft Fakes
279 | FakesAssemblies/
280 |
281 | # GhostDoc plugin setting file
282 | *.GhostDoc.xml
283 |
284 | # Node.js Tools for Visual Studio
285 | .ntvs_analysis.dat
286 | node_modules/
287 |
288 | # Visual Studio 6 build log
289 | *.plg
290 |
291 | # Visual Studio 6 workspace options file
292 | *.opt
293 |
294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
295 | *.vbw
296 |
297 | # Visual Studio 6 auto-generated project file (contains which files were open etc.)
298 | *.vbp
299 |
300 | # Visual Studio 6 workspace and project file (working project files containing files to include in project)
301 | *.dsw
302 | *.dsp
303 |
304 | # Visual Studio 6 technical files
305 | *.ncb
306 | *.aps
307 |
308 | # Visual Studio LightSwitch build output
309 | **/*.HTMLClient/GeneratedArtifacts
310 | **/*.DesktopClient/GeneratedArtifacts
311 | **/*.DesktopClient/ModelManifest.xml
312 | **/*.Server/GeneratedArtifacts
313 | **/*.Server/ModelManifest.xml
314 | _Pvt_Extensions
315 |
316 | # Paket dependency manager
317 | .paket/paket.exe
318 | paket-files/
319 |
320 | # FAKE - F# Make
321 | .fake/
322 |
323 | # CodeRush personal settings
324 | .cr/personal
325 |
326 | # Python Tools for Visual Studio (PTVS)
327 | __pycache__/
328 | *.pyc
329 |
330 | # Cake - Uncomment if you are using it
331 | # tools/**
332 | # !tools/packages.config
333 |
334 | # Tabs Studio
335 | *.tss
336 |
337 | # Telerik's JustMock configuration file
338 | *.jmconfig
339 |
340 | # BizTalk build output
341 | *.btp.cs
342 | *.btm.cs
343 | *.odx.cs
344 | *.xsd.cs
345 |
346 | # OpenCover UI analysis results
347 | OpenCover/
348 |
349 | # Azure Stream Analytics local run output
350 | ASALocalRun/
351 |
352 | # MSBuild Binary and Structured Log
353 | *.binlog
354 |
355 | # NVidia Nsight GPU debugger configuration file
356 | *.nvuser
357 |
358 | # MFractors (Xamarin productivity tool) working folder
359 | .mfractor/
360 |
361 | # Local History for Visual Studio
362 | .localhistory/
363 |
364 | # Visual Studio History (VSHistory) files
365 | .vshistory/
366 |
367 | # BeatPulse healthcheck temp database
368 | healthchecksdb
369 |
370 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
371 | MigrationBackup/
372 |
373 | # Ionide (cross platform F# VS Code tools) working folder
374 | .ionide/
375 |
376 | # Fody - auto-generated XML schema
377 | FodyWeavers.xsd
378 |
379 | # VS Code files for those working on multiple tools
380 | .vscode/*
381 | !.vscode/settings.json
382 | !.vscode/tasks.json
383 | !.vscode/launch.json
384 | !.vscode/extensions.json
385 | *.code-workspace
386 |
387 | # Local History for Visual Studio Code
388 | .history/
389 |
390 | # Windows Installer files from build outputs
391 | *.cab
392 | *.msi
393 | *.msix
394 | *.msm
395 | *.msp
396 |
397 | # JetBrains Rider
398 | *.sln.iml
399 |
--------------------------------------------------------------------------------
/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 12.0
5 |
6 |
7 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 Matt Lacey
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Pro XAML Toolbox
2 |
3 | [](LICENSE)
4 | 
5 | [](https://github.com/mrlacey/ProXamlToolbox/actions/workflows/build.yaml)
6 | 
7 |
8 | It's like the standard Visual Studio Toolbox but **much** better.
9 |
10 | 
11 |
12 | **Currently supporting .NET MAUI**. _[WPF](https://github.com/mrlacey/ProXamlToolbox/issues/2), & [WinUI](https://github.com/mrlacey/ProXamlToolbox/issues/1) support coming soon - maybe._
13 |
14 | :alembic: A [Rapid XAML Toolkit](https://github.com/mrlacey/rapid-xaml-toolkit) experiment. If/when this ships beyond an experiment/preview, it will be moved to that project and repository.
15 |
16 | ---
17 |
18 | ## What?
19 |
20 | A Visual Studio extension that adds a new tool window.
21 |
22 | It's a cross between Visual Studio's Toolbox and the ability to use smart snippets.
23 |
24 | There are 2 ways of using it:
25 |
26 | You can **drag items onto the editor** and get a much richer snippet.
27 |
28 | **Or**, you can **double-click on an item**, and it will be added in the editor where the cursor is positioned.
29 | **But** if you add an element that is (or can be) a container for other elements, the cursor is moved inside the added element.
30 | This means that if you want two `Button`s inside a `Grid` you can double-click the `Grid` item and then double-click the `Button` item twice and you'll get all this:
31 |
32 | ```xml
33 |
37 |
42 |
47 |
48 |
49 | ```
50 |
51 | Not bad for **only 3 [double-]clicks**. Just imagine how many keystrokes that saves you!
52 |
53 | ### It doesn't (& cant) do everything
54 |
55 | Look at the above code and you'll see that it's not 100% how you'd want in your code. This is intentional. It doesn't know what name you might want to give your `Grid` or what the `Text` or `Hint` should be on each `Button`.
56 |
57 | However, it's easier to change placeholder values than to have to write everything from scratch. It's also easier for people who don't know what properties are available (or should be set).
58 |
59 | ### It's configurable!
60 |
61 | Yes, you can choose between common preferences for coding style and requirements.
62 |
63 | Options:
64 |
65 | - Include an `x:Name` attribute for each added element.
66 | - Prefer the use of **Events** or **Commnads**.
67 | - Include common accessibility-related properties.
68 |
69 | ### Only does what's necessary
70 |
71 | The XAML it adds to the file isn't ideally formatted. This is by design.
72 |
73 | There are other tools ([XAML Styler](https://marketplace.visualstudio.com/items?itemName=TeamXavalon.XAMLStyler) is recommended) that can format your code how you want it. Recreating this functionality wouldn't be a good use of my time. Just like it isn't a good use of your time to type all of your XAML.
74 |
75 | ## Why?
76 |
77 | Because you should have better uses for your time than typing all your XAML!
78 |
79 | ## Feedback wanted
80 |
81 | This extension is being released as a preview. Please [open issues](https://github.com/mrlacey/ProXamlToolbox/issues) with comments, feedback, suggestions, etc.
82 |
--------------------------------------------------------------------------------
/art/ProXamlToolbox.pdn:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrlacey/ProXamlToolbox/d9b8c519bcb60c035f7848e944e7fdb04843ec79/art/ProXamlToolbox.pdn
--------------------------------------------------------------------------------
/art/ProXamlToolbox.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrlacey/ProXamlToolbox/d9b8c519bcb60c035f7848e944e7fdb04843ec79/art/ProXamlToolbox.png
--------------------------------------------------------------------------------
/art/WPFToolBox.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrlacey/ProXamlToolbox/d9b8c519bcb60c035f7848e944e7fdb04843ec79/art/WPFToolBox.png
--------------------------------------------------------------------------------
/art/WPFToolBox96.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrlacey/ProXamlToolbox/d9b8c519bcb60c035f7848e944e7fdb04843ec79/art/WPFToolBox96.png
--------------------------------------------------------------------------------
/art/screenshot-darkandlight.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrlacey/ProXamlToolbox/d9b8c519bcb60c035f7848e944e7fdb04843ec79/art/screenshot-darkandlight.png
--------------------------------------------------------------------------------
/nuget.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/.editorconfig:
--------------------------------------------------------------------------------
1 | [*.cs]
2 |
3 | # SA1600: Elements should be documented
4 | dotnet_diagnostic.SA1600.severity = none
5 |
6 | # SA1618: Generic type parameters should be documented
7 | dotnet_diagnostic.SA1618.severity = none
8 |
9 | # SA1604: Element documentation should have summary
10 | dotnet_diagnostic.SA1604.severity = none
11 |
12 | # SA1611: Element parameters should be documented
13 | dotnet_diagnostic.SA1611.severity = none
14 |
15 | # SA1612: Element parameter documentation should match element parameters
16 | dotnet_diagnostic.SA1612.severity = none
17 |
18 | # SA0001: XML comment analysis is disabled due to project configuration
19 | dotnet_diagnostic.SA0001.severity = none
20 |
21 | # SA1602: Enumeration items should be documented
22 | dotnet_diagnostic.SA1602.severity = none
23 |
24 | # Default severity for analyzer diagnostics with category 'StyleCop.CSharp.DocumentationRules'
25 | dotnet_analyzer_diagnostic.category-StyleCop.CSharp.DocumentationRules.severity = none
26 | csharp_indent_labels = one_less_than_current
27 | csharp_using_directive_placement = outside_namespace:silent
28 | csharp_prefer_simple_using_statement = true:suggestion
29 | csharp_prefer_braces = true:silent
30 | csharp_style_namespace_declarations = block_scoped:silent
31 | csharp_style_prefer_method_group_conversion = true:silent
32 | csharp_style_prefer_top_level_statements = true:silent
33 | csharp_style_expression_bodied_methods = false:silent
34 | csharp_style_expression_bodied_constructors = false:silent
35 | csharp_style_expression_bodied_operators = false:silent
36 | csharp_style_expression_bodied_properties = true:silent
37 | csharp_style_expression_bodied_indexers = true:silent
38 | csharp_style_expression_bodied_accessors = true:silent
39 | csharp_style_expression_bodied_lambdas = true:silent
40 | csharp_style_expression_bodied_local_functions = false:silent
41 | csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent
42 | csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true:silent
43 | csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent
44 | csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent
45 | csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent
46 | csharp_style_prefer_extended_property_pattern = true:suggestion
47 | csharp_style_prefer_primary_constructors = true:suggestion
48 | csharp_prefer_system_threading_lock = true:suggestion
49 |
50 | [*.{cs,vb}]
51 | #### Naming styles ####
52 |
53 | # Naming rules
54 |
55 | dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
56 | dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
57 | dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
58 |
59 | dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
60 | dotnet_naming_rule.types_should_be_pascal_case.symbols = types
61 | dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
62 |
63 | dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
64 | dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
65 | dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
66 |
67 | # Symbol specifications
68 |
69 | dotnet_naming_symbols.interface.applicable_kinds = interface
70 | dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
71 | dotnet_naming_symbols.interface.required_modifiers =
72 |
73 | dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
74 | dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
75 | dotnet_naming_symbols.types.required_modifiers =
76 |
77 | dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
78 | dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
79 | dotnet_naming_symbols.non_field_members.required_modifiers =
80 |
81 | # Naming styles
82 |
83 | dotnet_naming_style.begins_with_i.required_prefix = I
84 | dotnet_naming_style.begins_with_i.required_suffix =
85 | dotnet_naming_style.begins_with_i.word_separator =
86 | dotnet_naming_style.begins_with_i.capitalization = pascal_case
87 |
88 | dotnet_naming_style.pascal_case.required_prefix =
89 | dotnet_naming_style.pascal_case.required_suffix =
90 | dotnet_naming_style.pascal_case.word_separator =
91 | dotnet_naming_style.pascal_case.capitalization = pascal_case
92 |
93 | dotnet_naming_style.pascal_case.required_prefix =
94 | dotnet_naming_style.pascal_case.required_suffix =
95 | dotnet_naming_style.pascal_case.word_separator =
96 | dotnet_naming_style.pascal_case.capitalization = pascal_case
97 | dotnet_style_operator_placement_when_wrapping = beginning_of_line
98 | tab_width = 4
99 | indent_size = 4
100 | end_of_line = crlf
101 | dotnet_style_coalesce_expression = true:suggestion
102 | dotnet_style_null_propagation = true:suggestion
103 | dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
104 | dotnet_style_prefer_auto_properties = true:silent
105 | dotnet_style_object_initializer = true:suggestion
106 | dotnet_style_collection_initializer = true:suggestion
107 | dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
108 | dotnet_style_prefer_conditional_expression_over_assignment = true:silent
109 | dotnet_style_prefer_conditional_expression_over_return = true:silent
110 | dotnet_style_explicit_tuple_names = true:suggestion
111 | dotnet_style_prefer_inferred_tuple_names = true:suggestion
112 | dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
113 | dotnet_style_prefer_compound_assignment = true:suggestion
114 | dotnet_style_prefer_simplified_interpolation = true:suggestion
115 | dotnet_style_allow_multiple_blank_lines_experimental = true:silent
116 | dotnet_style_allow_statement_immediately_after_block_experimental = true:silent
117 | insert_final_newline = true
118 |
--------------------------------------------------------------------------------
/src/ProXamlToolbox.Tests/InsertLogicTests.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.VisualStudio.TestTools.UnitTesting;
2 |
3 | namespace ProXamlToolbox.Tests
4 | {
5 | #pragma warning disable IDE0042 // Deconstruct variable declaration
6 | [TestClass]
7 | public class InsertLogicTests
8 | {
9 | [TestMethod]
10 | public void Blank_Zero_Zero()
11 | {
12 | var sut = new InsertLogic(0, 0, BlankToolboxItem(), AllSettingsOff());
13 |
14 | var actual = sut.GetFormattedTextAndOffsets("");
15 |
16 | Assert.AreEqual("", actual.Formatted);
17 | Assert.AreEqual(-1, actual.LineOffset);
18 | Assert.AreEqual(-1, actual.PositionOffset);
19 | }
20 |
21 | [TestMethod]
22 | public void Something_Zero_Zero()
23 | {
24 | var sut = new InsertLogic(0, 0, BlankToolboxItem(), AllSettingsOff());
25 |
26 | var actual = sut.GetFormattedTextAndOffsets("something");
27 |
28 | Assert.AreEqual("something", actual.Formatted);
29 | Assert.AreEqual(-1, actual.LineOffset);
30 | Assert.AreEqual(-1, actual.PositionOffset);
31 | }
32 |
33 | [TestMethod]
34 | public void Something_Two_Two()
35 | {
36 | var sut = new InsertLogic(2, 2, BlankToolboxItem(), AllSettingsOff());
37 |
38 | var actual = sut.GetFormattedTextAndOffsets("something");
39 |
40 | Assert.AreEqual("something", actual.Formatted);
41 | Assert.AreEqual(-1, actual.LineOffset);
42 | Assert.AreEqual(-1, actual.PositionOffset);
43 | }
44 |
45 | [TestMethod]
46 | public void SomethingEndingWithNewLine()
47 | {
48 | var sut = new InsertLogic(2, 2, BlankToolboxItem(), AllSettingsOff());
49 |
50 | var actual = sut.GetFormattedTextAndOffsets("something\r\n");
51 |
52 | Assert.AreEqual("something\r\n", actual.Formatted);
53 | Assert.AreEqual(-1, actual.LineOffset);
54 | Assert.AreEqual(-1, actual.PositionOffset);
55 | }
56 |
57 | [TestMethod]
58 | public void SomethingWithNewLineInMiddle()
59 | {
60 | var sut = new InsertLogic(2, 2, BlankToolboxItem(), AllSettingsOff());
61 |
62 | var actual = sut.GetFormattedTextAndOffsets("some\r\nthing");
63 |
64 | Assert.AreEqual("some\r\nthing", actual.Formatted);
65 | Assert.AreEqual(-1, actual.LineOffset);
66 | Assert.AreEqual(-1, actual.PositionOffset);
67 | }
68 |
69 | [TestMethod]
70 | public void SomethingWithInsertPointInMiddle()
71 | {
72 | var sut = new InsertLogic(2, 2, BlankToolboxItem(), AllSettingsOff());
73 |
74 | var actual = sut.GetFormattedTextAndOffsets("some*|*thing");
75 |
76 | Assert.AreEqual("something", actual.Formatted);
77 | Assert.AreEqual(2, actual.LineOffset);
78 | Assert.AreEqual(2 + "some".Length, actual.PositionOffset);
79 | }
80 |
81 | [TestMethod]
82 | public void SomethingWithInsertPointAtBeginning()
83 | {
84 | var sut = new InsertLogic(2, 2, BlankToolboxItem(), AllSettingsOff());
85 |
86 | var actual = sut.GetFormattedTextAndOffsets("*|*something");
87 |
88 | Assert.AreEqual("something", actual.Formatted);
89 | Assert.AreEqual(2, actual.LineOffset);
90 | Assert.AreEqual(2, actual.PositionOffset);
91 | }
92 |
93 | [TestMethod]
94 | public void InsertPointAfterNewLine()
95 | {
96 | var sut = new InsertLogic(2, 2, BlankToolboxItem(), AllSettingsOff());
97 |
98 | var actual = sut.GetFormattedTextAndOffsets("aaa\r\nbbb*|*ccc");
99 |
100 | Assert.AreEqual("aaa\r\nbbbccc", actual.Formatted);
101 | Assert.AreEqual(3, actual.LineOffset);
102 | Assert.AreEqual("bbb".Length, actual.PositionOffset);
103 | }
104 |
105 | [TestMethod]
106 | public void InsertPointAfterNewLineLonger()
107 | {
108 | var sut = new InsertLogic(2, 2, BlankToolboxItem(), AllSettingsOff());
109 |
110 | var actual = sut.GetFormattedTextAndOffsets("aaaaa\r\nbbbbb*|*ccccc");
111 |
112 | Assert.AreEqual("aaaaa\r\nbbbbbccccc", actual.Formatted);
113 | Assert.AreEqual(3, actual.LineOffset);
114 | Assert.AreEqual("bbbbb".Length, actual.PositionOffset);
115 | }
116 |
117 | [TestMethod]
118 | public void InsertPointAfterTwoNewLines()
119 | {
120 | var sut = new InsertLogic(2, 2, BlankToolboxItem(), AllSettingsOff());
121 |
122 | var actual = sut.GetFormattedTextAndOffsets("aaa\r\nbbb\r\nccc*|*ddd");
123 |
124 | Assert.AreEqual("aaa\r\nbbb\r\ncccddd", actual.Formatted);
125 | Assert.AreEqual(4, actual.LineOffset);
126 | Assert.AreEqual("ccc".Length, actual.PositionOffset);
127 | }
128 |
129 | [TestMethod]
130 | public void InsertPointBeforeNewLine()
131 | {
132 | var sut = new InsertLogic(2, 2, BlankToolboxItem(), AllSettingsOff());
133 |
134 | var actual = sut.GetFormattedTextAndOffsets("aaa*|*bbb\r\nccc");
135 |
136 | Assert.AreEqual("aaabbb\r\nccc", actual.Formatted);
137 | Assert.AreEqual(2, actual.LineOffset);
138 | Assert.AreEqual(2 + "aaa".Length, actual.PositionOffset);
139 | }
140 |
141 | [TestMethod]
142 | public void RemoveXNamePlaceholder()
143 | {
144 | var sut = new InsertLogic(2, 2, BlankToolboxItem(), AllSettingsOff());
145 |
146 | var actual = sut.GetFormattedTextAndOffsets("");
147 |
148 | Assert.AreEqual("", actual.Formatted);
149 | Assert.AreEqual(-1, actual.LineOffset);
150 | Assert.AreEqual(-1, actual.PositionOffset);
151 | }
152 |
153 | // TODO: add tests for multiple commands
154 | // TODO: add tests for multiple events
155 |
156 | [TestMethod]
157 | public void MakeReplacements_PreferEvents()
158 | {
159 | var sut = new InsertLogic(2, 2, BlankToolboxItem(), SettingsPreferCommands(false));
160 |
161 | var actual = sut.MakeTextReplacements("");
162 |
163 | Assert.AreEqual("", actual);
164 | }
165 |
166 | [TestMethod]
167 | public void MakeReplacements_PreferCommands()
168 | {
169 | var sut = new InsertLogic(2, 2, BlankToolboxItem(), SettingsPreferCommands(true));
170 |
171 | var actual = sut.MakeTextReplacements("");
172 |
173 | Assert.AreEqual("", actual);
174 | }
175 |
176 | // TODO: add tests mixing commands/events and A11y properties
177 | // TODO: add tests for adding multiple A11y properties at once
178 |
179 | [TestMethod]
180 | public void MakeReplacements_IncludeA11y()
181 | {
182 | var sut = new InsertLogic(2, 2, BlankToolboxItem(), SettingsIncludeA11y(true));
183 |
184 | var actual = sut.MakeTextReplacements("");
185 |
186 | Assert.AreEqual("", actual);
187 | }
188 |
189 | [TestMethod]
190 | public void MakeReplacements_DoNotIncludeA11y()
191 | {
192 | var sut = new InsertLogic(2, 2, BlankToolboxItem(), SettingsIncludeA11y(false));
193 |
194 | var actual = sut.MakeTextReplacements("");
195 |
196 | Assert.AreEqual("", actual);
197 | }
198 |
199 | private ProToolboxItem BlankToolboxItem()
200 | {
201 | return new ProToolboxItem();
202 | }
203 |
204 | private ToolboxSettings AllSettingsOff()
205 | {
206 | return new ToolboxSettings();
207 | }
208 |
209 | private ToolboxSettings SettingsPreferCommands(bool preferCommands)
210 | {
211 | return new ToolboxSettings() { PreferCommands = preferCommands };
212 | }
213 |
214 | private ToolboxSettings SettingsIncludeA11y(bool includeA11y)
215 | {
216 | return new ToolboxSettings() { IncludeA11y = includeA11y };
217 | }
218 | }
219 | }
220 |
--------------------------------------------------------------------------------
/src/ProXamlToolbox.Tests/ProXamlToolbox.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {D3B81B5D-157E-4E08-8B50-8545A9E434C4}
8 | Library
9 | Properties
10 | ProXamlToolbox.Tests
11 | ProXamlToolbox.Tests
12 | v4.8
13 | 512
14 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
15 | 15.0
16 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
17 | $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages
18 | False
19 | UnitTest
20 |
21 |
22 |
23 |
24 | true
25 | full
26 | false
27 | bin\Debug\
28 | DEBUG;TRACE
29 | prompt
30 | 4
31 |
32 |
33 | pdbonly
34 | true
35 | bin\Release\
36 | TRACE
37 | prompt
38 | 4
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | 2.5.192
51 |
52 |
53 | 3.6.4
54 |
55 |
56 | 3.6.4
57 |
58 |
59 | 3.6.4
60 | runtime; build; native; contentfiles; analyzers; buildtransitive
61 | all
62 |
63 |
64 | 1.7.0
65 | runtime; build; native; contentfiles; analyzers; buildtransitive
66 | all
67 |
68 |
69 |
70 |
71 | {4effd54e-dc16-41e7-a523-af78ef8af4d3}
72 | ProXamlToolbox
73 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/src/ProXamlToolbox.Tests/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | [assembly: AssemblyTitle("ProXamlToolbox.Tests")]
6 | [assembly: AssemblyDescription("")]
7 | [assembly: AssemblyConfiguration("")]
8 | [assembly: AssemblyCompany("")]
9 | [assembly: AssemblyProduct("ProXamlToolbox.Tests")]
10 | [assembly: AssemblyCopyright("Copyright © 2023")]
11 | [assembly: AssemblyTrademark("")]
12 | [assembly: AssemblyCulture("")]
13 |
14 | [assembly: ComVisible(false)]
15 |
16 | [assembly: Guid("d3b81b5d-157e-4e08-8b50-8545a9e434c4")]
17 |
18 | // [assembly: AssemblyVersion("1.0.*")]
19 | [assembly: AssemblyVersion("1.0.0.0")]
20 | [assembly: AssemblyFileVersion("1.0.0.0")]
21 |
--------------------------------------------------------------------------------
/src/ProXamlToolbox.lutconfig:
--------------------------------------------------------------------------------
1 |
2 | ..\
3 | true
4 | true
5 | 180000
6 |
--------------------------------------------------------------------------------
/src/ProXamlToolbox.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.6.33717.318
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProXamlToolbox", "ProXamlToolbox\ProXamlToolbox.csproj", "{4EFFD54E-DC16-41E7-A523-AF78EF8AF4D3}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProXamlToolbox.Tests", "ProXamlToolbox.Tests\ProXamlToolbox.Tests.csproj", "{D3B81B5D-157E-4E08-8B50-8545A9E434C4}"
9 | EndProject
10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{14A7D258-9BCC-45AF-81A0-017E9BCDC870}"
11 | ProjectSection(SolutionItems) = preProject
12 | .editorconfig = .editorconfig
13 | ..\README.md = ..\README.md
14 | EndProjectSection
15 | EndProject
16 | Global
17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
18 | Debug|Any CPU = Debug|Any CPU
19 | Debug|arm64 = Debug|arm64
20 | Debug|x86 = Debug|x86
21 | Release|Any CPU = Release|Any CPU
22 | Release|arm64 = Release|arm64
23 | Release|x86 = Release|x86
24 | EndGlobalSection
25 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
26 | {4EFFD54E-DC16-41E7-A523-AF78EF8AF4D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {4EFFD54E-DC16-41E7-A523-AF78EF8AF4D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {4EFFD54E-DC16-41E7-A523-AF78EF8AF4D3}.Debug|arm64.ActiveCfg = Debug|arm64
29 | {4EFFD54E-DC16-41E7-A523-AF78EF8AF4D3}.Debug|arm64.Build.0 = Debug|arm64
30 | {4EFFD54E-DC16-41E7-A523-AF78EF8AF4D3}.Debug|x86.ActiveCfg = Debug|x86
31 | {4EFFD54E-DC16-41E7-A523-AF78EF8AF4D3}.Debug|x86.Build.0 = Debug|x86
32 | {4EFFD54E-DC16-41E7-A523-AF78EF8AF4D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
33 | {4EFFD54E-DC16-41E7-A523-AF78EF8AF4D3}.Release|Any CPU.Build.0 = Release|Any CPU
34 | {4EFFD54E-DC16-41E7-A523-AF78EF8AF4D3}.Release|arm64.ActiveCfg = Release|arm64
35 | {4EFFD54E-DC16-41E7-A523-AF78EF8AF4D3}.Release|arm64.Build.0 = Release|arm64
36 | {4EFFD54E-DC16-41E7-A523-AF78EF8AF4D3}.Release|x86.ActiveCfg = Release|x86
37 | {4EFFD54E-DC16-41E7-A523-AF78EF8AF4D3}.Release|x86.Build.0 = Release|x86
38 | {D3B81B5D-157E-4E08-8B50-8545A9E434C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
39 | {D3B81B5D-157E-4E08-8B50-8545A9E434C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
40 | {D3B81B5D-157E-4E08-8B50-8545A9E434C4}.Debug|arm64.ActiveCfg = Debug|Any CPU
41 | {D3B81B5D-157E-4E08-8B50-8545A9E434C4}.Debug|arm64.Build.0 = Debug|Any CPU
42 | {D3B81B5D-157E-4E08-8B50-8545A9E434C4}.Debug|x86.ActiveCfg = Debug|Any CPU
43 | {D3B81B5D-157E-4E08-8B50-8545A9E434C4}.Debug|x86.Build.0 = Debug|Any CPU
44 | {D3B81B5D-157E-4E08-8B50-8545A9E434C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
45 | {D3B81B5D-157E-4E08-8B50-8545A9E434C4}.Release|Any CPU.Build.0 = Release|Any CPU
46 | {D3B81B5D-157E-4E08-8B50-8545A9E434C4}.Release|arm64.ActiveCfg = Release|Any CPU
47 | {D3B81B5D-157E-4E08-8B50-8545A9E434C4}.Release|arm64.Build.0 = Release|Any CPU
48 | {D3B81B5D-157E-4E08-8B50-8545A9E434C4}.Release|x86.ActiveCfg = Release|Any CPU
49 | {D3B81B5D-157E-4E08-8B50-8545A9E434C4}.Release|x86.Build.0 = Release|Any CPU
50 | EndGlobalSection
51 | GlobalSection(SolutionProperties) = preSolution
52 | HideSolutionNode = FALSE
53 | EndGlobalSection
54 | GlobalSection(ExtensibilityGlobals) = postSolution
55 | SolutionGuid = {087D5747-3634-43AD-870D-6B756D4E27F0}
56 | EndGlobalSection
57 | EndGlobal
58 |
--------------------------------------------------------------------------------
/src/ProXamlToolbox/AnalyticsConfig.cs:
--------------------------------------------------------------------------------
1 | namespace ProXamlToolbox
2 | {
3 | public static class AnalyticsConfig
4 | {
5 | public static string TelemetryConnectionString { get; set; } = "";
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/ProXamlToolbox/InsertLogic.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ProXamlToolbox
4 | {
5 | public class InsertLogic
6 | {
7 | public InsertLogic(int line, int lineCharOffset, ProToolboxItem pti, ToolboxSettings settings)
8 | {
9 | Line = line;
10 | LineCharOffset = lineCharOffset;
11 | ViewModel = pti;
12 | Settings = settings;
13 | }
14 |
15 | public int Line { get; }
16 |
17 | public int LineCharOffset { get; }
18 |
19 | public ProToolboxItem ViewModel { get; }
20 |
21 | public ToolboxSettings Settings { get; }
22 |
23 | public string MakeTextReplacements(string originalString)
24 | {
25 | var result = originalString;
26 |
27 | if (result.Contains(ProToolboxItem.XNamePlaceholder))
28 | {
29 | if (Settings.IncludeXName)
30 | {
31 | result = result.Replace(ProToolboxItem.XNamePlaceholder, $" x:Name=\"{ViewModel.DisplayedText}{new Random().Next(8999) + 1000}\"");
32 | }
33 | else
34 | {
35 | result = result.Replace(ProToolboxItem.XNamePlaceholder, string.Empty);
36 | }
37 | }
38 |
39 | if (Settings.PreferCommands)
40 | {
41 | // Include all commands
42 | result = result.Replace(ProToolboxItem.CommandPrefixPlaceholder, " ");
43 |
44 | // Remove all events
45 | while (result.Contains(ProToolboxItem.EventPrefixPlaceholder))
46 | {
47 | var eIndex = result.IndexOf(ProToolboxItem.EventPrefixPlaceholder);
48 |
49 | // TODO: change to searching for second quote (the closing one) as may not always be followed by a space
50 | var eEndIndex = result.IndexOf("\" ", eIndex);
51 |
52 | if (eEndIndex == -1)
53 | {
54 | eEndIndex = result.IndexOf("\">", eIndex);
55 | }
56 |
57 | if (eEndIndex == -1)
58 | {
59 | System.Diagnostics.Debugger.Break();
60 | }
61 |
62 | var eEnd = result.Substring(eEndIndex + 1);
63 | result = result.Substring(0, eIndex) + eEnd;
64 | }
65 | }
66 | else
67 | {
68 | // Include all events
69 | result = result.Replace(ProToolboxItem.EventPrefixPlaceholder, " ");
70 |
71 | // Remove all commands
72 | while (result.Contains(ProToolboxItem.CommandPrefixPlaceholder))
73 | {
74 | var cIndex = result.IndexOf(ProToolboxItem.CommandPrefixPlaceholder);
75 |
76 | var cEndIndex = result.IndexOf("\" ", cIndex);
77 |
78 | if (cEndIndex == -1)
79 | {
80 | cEndIndex = result.IndexOf("\">", cIndex);
81 | }
82 |
83 | if (cEndIndex == -1)
84 | {
85 | System.Diagnostics.Debugger.Break();
86 | }
87 |
88 | var cEnd = result.Substring(cEndIndex + 1);
89 | result = result.Substring(0, cIndex) + cEnd;
90 | }
91 | }
92 |
93 | if (Settings.IncludeA11y)
94 | {
95 | result = result.Replace(ProToolboxItem.AllyPrefixPlaceholder, " ");
96 | }
97 | else
98 | {
99 | while (result.Contains(ProToolboxItem.AllyPrefixPlaceholder))
100 | {
101 | var aIndex = result.IndexOf(ProToolboxItem.AllyPrefixPlaceholder);
102 |
103 | // TODO: change to searching for second quote
104 | var aEndIndex = result.IndexOf("\" ", aIndex);
105 |
106 | if (aEndIndex == -1)
107 | {
108 | aEndIndex = result.IndexOf("\">", aIndex);
109 | }
110 |
111 | if (aEndIndex == -1)
112 | {
113 | System.Diagnostics.Debugger.Break();
114 | }
115 |
116 | var aEnd = result.Substring(aEndIndex + 1);
117 | result = result.Substring(0, aIndex) + aEnd;
118 | }
119 | }
120 |
121 | return result;
122 | }
123 |
124 | public (string Formatted, int LineOffset, int PositionOffset) GetFormattedTextAndOffsets(string originalString)
125 | {
126 | var lineOffset = this.Line;
127 | var posOffset = this.LineCharOffset;
128 |
129 | var insertText = MakeTextReplacements(originalString);
130 | var insertOffset = -1;
131 |
132 | if (insertText.Contains(ProToolboxItem.CursorPlaceholder))
133 | {
134 | insertOffset = insertText.IndexOf(ProToolboxItem.CursorPlaceholder);
135 |
136 | lineOffset += insertText.Substring(0, insertOffset).Split(new[] { "\r\n" }, StringSplitOptions.None).Length - 1;
137 |
138 | var offsetOnNewLine = insertText.Substring(0, insertOffset).LastIndexOf("\r\n");
139 |
140 | if (offsetOnNewLine >= 0)
141 | {
142 | posOffset = 0;
143 |
144 | insertOffset = insertOffset - offsetOnNewLine - 2;
145 | }
146 |
147 | insertOffset += posOffset;
148 | insertText = insertText.Replace(ProToolboxItem.CursorPlaceholder, string.Empty);
149 | }
150 | else
151 | {
152 | lineOffset = -1;
153 | }
154 |
155 | return (insertText, lineOffset, insertOffset);
156 | }
157 | }
158 | }
159 |
--------------------------------------------------------------------------------
/src/ProXamlToolbox/Key.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrlacey/ProXamlToolbox/d9b8c519bcb60c035f7848e944e7fdb04843ec79/src/ProXamlToolbox/Key.snk
--------------------------------------------------------------------------------
/src/ProXamlToolbox/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Rapid XAML Toolkit
2 |
3 | Copyright (c) Matt Lacey Ltd. All rights reserved.
4 |
5 | MIT License
6 |
7 | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | of this software and associated documentation files (the "Software"), to deal
9 | in the Software without restriction, including without limitation the rights
10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | copies of the Software, and to permit persons to whom the Software is
12 | furnished to do so, subject to the following conditions:
13 |
14 | The above copyright notice and this permission notice shall be included in all
15 | copies or substantial portions of the Software.
16 |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | SOFTWARE
24 |
--------------------------------------------------------------------------------
/src/ProXamlToolbox/OutputPane.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 | using Microsoft.VisualStudio;
4 | using Microsoft.VisualStudio.Shell;
5 | using Microsoft.VisualStudio.Shell.Interop;
6 | using Task = System.Threading.Tasks.Task;
7 |
8 | namespace ProXamlToolbox
9 | {
10 | public class OutputPane
11 | {
12 | private static Guid pxtPaneGuid = new Guid("002A8552-5B63-4765-9970-69B016BB9AF4");
13 |
14 | private static OutputPane instance;
15 |
16 | private readonly IVsOutputWindowPane pane;
17 |
18 | private OutputPane()
19 | {
20 | ThreadHelper.ThrowIfNotOnUIThread();
21 |
22 | if (ServiceProvider.GlobalProvider.GetService(typeof(SVsOutputWindow)) is IVsOutputWindow outWindow
23 | && (ErrorHandler.Failed(outWindow.GetPane(ref pxtPaneGuid, out pane)) || pane == null))
24 | {
25 | if (ErrorHandler.Failed(outWindow.CreatePane(ref pxtPaneGuid, Vsix.Name, 1, 0)))
26 | {
27 | System.Diagnostics.Debug.WriteLine("Failed to create the Output window pane.");
28 | return;
29 | }
30 |
31 | if (ErrorHandler.Failed(outWindow.GetPane(ref pxtPaneGuid, out pane)) || (pane == null))
32 | {
33 | System.Diagnostics.Debug.WriteLine("Failed to get access to the Output window pane.");
34 | }
35 | }
36 | }
37 |
38 | public static OutputPane Instance => instance ??= new OutputPane();
39 |
40 | public async Task ActivateAsync()
41 | {
42 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(CancellationToken.None);
43 |
44 | pane?.Activate();
45 | }
46 |
47 | public async Task WriteAsync(string message)
48 | {
49 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(CancellationToken.None);
50 |
51 | _ = (pane?.OutputStringThreadSafe($"{message}{Environment.NewLine}"));
52 | }
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/src/ProXamlToolbox/ProToolboxItem.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.VisualStudio.Imaging.Interop;
2 |
3 | namespace ProXamlToolbox
4 | {
5 | public class ProToolboxItem
6 | {
7 | public const string CursorPlaceholder = "*|*";
8 | public const string XNamePlaceholder = " [XN]";
9 | public const string CommandPrefixPlaceholder = "[CMD]";
10 | public const string EventPrefixPlaceholder = "[EVNT]";
11 | public const string AllyPrefixPlaceholder = "[A11Y]";
12 |
13 | public TargetPlatform Platforms { get; set; } = TargetPlatform.MauiAndWinui;
14 |
15 | public ImageMoniker ImageMoniker { get; set; }
16 |
17 | public string DisplayedText { get; set; }
18 |
19 | public string DefaultContent { get; set; }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/ProXamlToolbox/ProXamlToolbox.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 17.0
5 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
6 | true
7 |
8 |
9 |
10 | true
11 |
12 |
13 | Key.snk
14 |
15 |
16 |
17 |
18 |
19 |
20 | Debug
21 | AnyCPU
22 | 2.0
23 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
24 | {4EFFD54E-DC16-41E7-A523-AF78EF8AF4D3}
25 | Library
26 | Properties
27 | ProXamlToolbox
28 | ProXamlToolbox
29 | v4.8
30 | true
31 | true
32 | true
33 | true
34 | true
35 | false
36 | Program
37 | $(DevEnvDir)devenv.exe
38 | /rootsuffix Exp
39 |
40 |
41 | true
42 | full
43 | false
44 | bin\Debug\
45 | DEBUG;TRACE
46 | prompt
47 | 4
48 |
49 |
50 | pdbonly
51 | true
52 | bin\Release\
53 | TRACE
54 | prompt
55 | 4
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 | ProXamlToolboxWindowControl.xaml
67 |
68 |
69 |
70 | True
71 | True
72 | ProXamlToolboxWindowPackage.vsct
73 |
74 |
75 | True
76 | True
77 | source.extension.vsixmanifest
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 | Designer
88 | VsixManifestGenerator
89 | source.extension.cs
90 |
91 |
92 |
93 |
94 | 17.0.527
95 |
96 |
97 | 16.0.29.6
98 | runtime; build; native; contentfiles; analyzers; buildtransitive
99 | all
100 |
101 |
102 | 2.5.192
103 |
104 |
105 | 2.22.0
106 |
107 |
108 | 1.7.0
109 | runtime; build; native; contentfiles; analyzers; buildtransitive
110 | all
111 |
112 |
113 |
114 |
115 | Designer
116 | MSBuild:Compile
117 |
118 |
119 |
120 |
121 |
122 | PreserveNewest
123 | true
124 |
125 |
126 | PreserveNewest
127 | true
128 |
129 |
130 | VsctGenerator
131 | Menus.ctmenu
132 | ProXamlToolboxWindowPackage1.cs
133 |
134 |
135 |
136 |
137 |
138 |
139 | true
140 | VSPackage
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
160 |
161 |
--------------------------------------------------------------------------------
/src/ProXamlToolbox/ProXamlToolboxWindow.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using System.Threading;
4 | using System.Threading.Tasks;
5 | using System.Windows;
6 | using Community.VisualStudio.Toolkit;
7 | using Microsoft.VisualStudio.Imaging;
8 | using Microsoft.VisualStudio.Shell;
9 |
10 | namespace ProXamlToolbox
11 | {
12 | public class ProXamlToolboxWindow : BaseToolWindow
13 | {
14 | public override string GetTitle(int toolWindowId) => "Pro XAML Toolbox";
15 |
16 | public override Type PaneType => typeof(Pane);
17 |
18 | public override async Task CreateAsync(int toolWindowId, CancellationToken cancellationToken)
19 | {
20 | await Package.JoinableTaskFactory.SwitchToMainThreadAsync();
21 |
22 | return new ProXamlToolboxWindowControl();
23 | }
24 |
25 | [Guid("A6830831-ECBF-434E-A60F-40A16E714429")]
26 | public class Pane : ToolWindowPane
27 | {
28 | public Pane()
29 | {
30 | BitmapImageMoniker = KnownMonikers.ToolBox;
31 | }
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/ProXamlToolbox/ProXamlToolboxWindowCommand.cs:
--------------------------------------------------------------------------------
1 | using Community.VisualStudio.Toolkit;
2 | using Microsoft.VisualStudio.Shell;
3 | using Task = System.Threading.Tasks.Task;
4 |
5 | namespace ProXamlToolbox
6 | {
7 | [Command(PackageIds.ProXamlToolboxWindowCommandId)]
8 | internal sealed class ShowToolWindow : BaseCommand
9 | {
10 | protected override Task ExecuteAsync(OleMenuCmdEventArgs e) =>
11 | ProXamlToolboxWindow.ShowAsync();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/ProXamlToolbox/ProXamlToolboxWindowControl.xaml:
--------------------------------------------------------------------------------
1 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
28 |
29 |
30 |
31 |
34 |
35 |
36 |
40 |
41 |
42 |
46 |
47 |
48 |
49 |
50 |
54 |
61 |
62 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
84 |
85 |
88 |
89 |
90 |
91 |
92 |
96 |
103 |
104 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
126 |
127 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
--------------------------------------------------------------------------------
/src/ProXamlToolbox/ProXamlToolboxWindowControl.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls;
3 | using System.Windows.Input;
4 | using EnvDTE;
5 | using Microsoft.VisualStudio.Shell;
6 |
7 | namespace ProXamlToolbox
8 | {
9 | public partial class ProXamlToolboxWindowControl : UserControl
10 | {
11 | private readonly DTE dte;
12 |
13 | public ProXamlToolboxWindowControl()
14 | {
15 | ThreadHelper.ThrowIfNotOnUIThread();
16 | this.InitializeComponent();
17 | dte = Package.GetGlobalService(typeof(DTE)) as DTE;
18 |
19 | this.DataContext = new ToolboxViewModel();
20 | }
21 |
22 | private void OnToolboxItemMoved(object sender, System.Windows.Input.MouseEventArgs e)
23 | {
24 | if (e.LeftButton == MouseButtonState.Pressed)
25 | {
26 | if (sender is FrameworkElement fe && fe.DataContext is ProToolboxItem pti)
27 | {
28 | // Ensure what it dropped is formatted correctly
29 | var insertLogic = new InsertLogic(
30 | -1,
31 | -1,
32 | pti,
33 | new ToolboxSettings
34 | {
35 | IncludeXName = IncludeXName.IsChecked ?? false,
36 | PreferCommands = PreferCommands.IsChecked ?? false,
37 | IncludeA11y = IncludeA11y.IsChecked ?? false,
38 | });
39 |
40 | var textToInsert =
41 | insertLogic.MakeTextReplacements(pti.DefaultContent)
42 | .Replace(ProToolboxItem.CursorPlaceholder, string.Empty);
43 |
44 | DragDrop.DoDragDrop(fe, textToInsert, DragDropEffects.Copy);
45 | }
46 | }
47 | }
48 |
49 | private void OnToolboxItemMouseDown(object sender, MouseButtonEventArgs e)
50 | {
51 | ThreadHelper.ThrowIfNotOnUIThread();
52 |
53 | if (e.ChangedButton == MouseButton.Left && e.ClickCount == 2)
54 | {
55 | if (sender is FrameworkElement fe && fe.DataContext is ProToolboxItem pti)
56 | {
57 | Document activeDoc = dte.ActiveDocument;
58 |
59 | TextSelection selection = activeDoc.Selection as TextSelection;
60 |
61 | var insertLogic = new InsertLogic(
62 | selection.ActivePoint.Line,
63 | selection.ActivePoint.LineCharOffset,
64 | pti,
65 | new ToolboxSettings
66 | {
67 | IncludeXName = IncludeXName.IsChecked ?? false,
68 | PreferCommands = PreferCommands.IsChecked ?? false,
69 | IncludeA11y = IncludeA11y.IsChecked ?? false,
70 | });
71 |
72 | var (TextToInsert, InsertionLine, InsertionLineOffset) = insertLogic.GetFormattedTextAndOffsets(pti.DefaultContent);
73 |
74 | selection.Insert(TextToInsert);
75 |
76 | if (InsertionLine > -1)
77 | {
78 | // Add 1 to position offset as VS starts counting from 1
79 | selection.MoveToLineAndOffset(InsertionLine, InsertionLineOffset + 1);
80 | }
81 | }
82 | }
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/src/ProXamlToolbox/ProXamlToolboxWindowPackage.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Runtime.InteropServices;
4 | using System.Threading;
5 | using Community.VisualStudio.Toolkit;
6 | using Microsoft.ApplicationInsights;
7 | using Microsoft.ApplicationInsights.Extensibility;
8 | using Microsoft.VisualStudio.Shell;
9 | using Task = System.Threading.Tasks.Task;
10 |
11 | namespace ProXamlToolbox
12 | {
13 | ///
14 | /// This is the class that implements the package exposed by this assembly.
15 | ///
16 | ///
17 | ///
18 | /// The minimum requirement for a class to be considered a valid package for Visual Studio
19 | /// is to implement the IVsPackage interface and register itself with the shell.
20 | /// This package uses the helper classes defined inside the Managed Package Framework (MPF)
21 | /// to do it: it derives from the Package class that provides the implementation of the
22 | /// IVsPackage interface and uses the registration attributes defined in the framework to
23 | /// register itself and its components with the shell. These attributes tell the pkgdef creation
24 | /// utility what data to put into .pkgdef file.
25 | ///
26 | ///
27 | /// To get loaded into VS, the package must be referred by <Asset Type="Microsoft.VisualStudio.VsPackage" ...> in .vsixmanifest file.
28 | ///
29 | ///
30 | [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
31 | [InstalledProductRegistration(Vsix.Name, Vsix.Description, Vsix.Version, IconResourceID = 400)] // Info on this package for Help/About
32 | [Guid(PackageGuids.guidProXamlToolboxWindowPackageString)]
33 | [ProvideToolWindow(typeof(ProXamlToolboxWindow.Pane), Style = VsDockStyle.Tabbed, DockedWidth = 300, Window = WindowGuids.DocumentWell, Orientation = ToolWindowOrientation.Left)]
34 | [ProvideToolWindowVisibility(typeof(ProXamlToolboxWindow.Pane), UIContextGuid, bringToFront: true)]
35 | [ProvideUIContextRule(UIContextGuid,
36 | name: "Active editor is XAML file",
37 | expression: "xamlFile",
38 | termNames: new[] { "xamlFile" },
39 | termValues: new[] { "ActiveEditorContentType:XAML" })]
40 | [ProvideMenuResource("Menus.ctmenu", 1)]
41 | public sealed class ProXamlToolboxWindowPackage : ToolkitPackage
42 | {
43 | public const string UIContextGuid = "7E4B9E65-D661-4CEA-B2CD-99F5200397B4";
44 |
45 | protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress)
46 | {
47 | this.RegisterToolWindows();
48 |
49 | await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
50 | await this.RegisterCommandsAsync();
51 |
52 | await TrackBasicUsageAnalyticsAsync();
53 | }
54 |
55 | private static async Task TrackBasicUsageAnalyticsAsync()
56 | {
57 | try
58 | {
59 | #if !DEBUG
60 | if (string.IsNullOrWhiteSpace(AnalyticsConfig.TelemetryConnectionString))
61 | {
62 | return;
63 | }
64 |
65 | var config = new TelemetryConfiguration
66 | {
67 | ConnectionString = AnalyticsConfig.TelemetryConnectionString,
68 | };
69 |
70 | var client = new TelemetryClient(config);
71 |
72 | var properties = new Dictionary
73 | {
74 | { "VsixVersion", Vsix.Version },
75 | { "VsVersion", Microsoft.VisualStudio.Telemetry.TelemetryService.DefaultSession?.GetSharedProperty("VS.Core.ExeVersion") },
76 | { "Architecture", RuntimeInformation.ProcessArchitecture.ToString() },
77 | { "MsInternal", Microsoft.VisualStudio.Telemetry.TelemetryService.DefaultSession?.IsUserMicrosoftInternal.ToString() },
78 | };
79 |
80 | client.TrackEvent(Vsix.Name, properties);
81 | #endif
82 | }
83 | catch (Exception exc)
84 | {
85 | System.Diagnostics.Debug.WriteLine(exc);
86 | await OutputPane.Instance.WriteAsync("Error tracking usage analytics: " + exc.Message);
87 | }
88 | }
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/src/ProXamlToolbox/ProXamlToolboxWindowPackage.vsct:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/src/ProXamlToolbox/ProXamlToolboxWindowPackage1.cs:
--------------------------------------------------------------------------------
1 | // ------------------------------------------------------------------------------
2 | //
3 | // This file was generated by VSIX Synchronizer
4 | //
5 | // ------------------------------------------------------------------------------
6 | namespace ProXamlToolbox
7 | {
8 | using System;
9 |
10 | ///
11 | /// Helper class that exposes all GUIDs used across VS Package.
12 | ///
13 | internal sealed partial class PackageGuids
14 | {
15 | public const string guidProXamlToolboxWindowPackageString = "e3eff216-5897-4190-8950-7cf21985c50e";
16 | public static Guid guidProXamlToolboxWindowPackage = new Guid(guidProXamlToolboxWindowPackageString);
17 |
18 | public const string guidImagesString = "d7477da6-ccc3-4636-9e71-72434d1d1e3d";
19 | public static Guid guidImages = new Guid(guidImagesString);
20 | }
21 | ///
22 | /// Helper class that encapsulates all CommandIDs uses across VS Package.
23 | ///
24 | internal sealed partial class PackageIds
25 | {
26 | public const int ProXamlToolboxWindowCommandId = 0x0100;
27 | public const int bmpPic1 = 0x0001;
28 | }
29 | }
--------------------------------------------------------------------------------
/src/ProXamlToolbox/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 | using ProXamlToolbox;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle(Vsix.Name)]
9 | [assembly: AssemblyDescription(Vsix.Description)]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany(Vsix.Author)]
12 | [assembly: AssemblyProduct(Vsix.Name)]
13 | [assembly: AssemblyCopyright("")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | [assembly: AssemblyVersion(Vsix.Version)]
23 | [assembly: AssemblyFileVersion(Vsix.Version)]
24 |
--------------------------------------------------------------------------------
/src/ProXamlToolbox/Resources/ProXamlToolbox.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrlacey/ProXamlToolbox/d9b8c519bcb60c035f7848e944e7fdb04843ec79/src/ProXamlToolbox/Resources/ProXamlToolbox.png
--------------------------------------------------------------------------------
/src/ProXamlToolbox/Resources/ProXamlToolboxWindowCommand.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrlacey/ProXamlToolbox/d9b8c519bcb60c035f7848e944e7fdb04843ec79/src/ProXamlToolbox/Resources/ProXamlToolboxWindowCommand.png
--------------------------------------------------------------------------------
/src/ProXamlToolbox/Resources/ProXamlToolboxWindowPackage.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mrlacey/ProXamlToolbox/d9b8c519bcb60c035f7848e944e7fdb04843ec79/src/ProXamlToolbox/Resources/ProXamlToolboxWindowPackage.ico
--------------------------------------------------------------------------------
/src/ProXamlToolbox/TargetPlatform.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ProXamlToolbox
4 | {
5 | [Flags]
6 | public enum TargetPlatform
7 | {
8 | Maui = 1,
9 | WinUI = 2,
10 | Wpf = 4,
11 | MauiAndWinui = Maui | WinUI,
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/ProXamlToolbox/ToolboxSettings.cs:
--------------------------------------------------------------------------------
1 | namespace ProXamlToolbox
2 | {
3 | public class ToolboxSettings
4 | {
5 | public bool IncludeA11y { get; set; }
6 |
7 | public bool IncludeXName { get; set; }
8 |
9 | public bool PreferCommands { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/ProXamlToolbox/ToolboxViewModel.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.ObjectModel;
2 | using Microsoft.VisualStudio.Imaging;
3 |
4 | namespace ProXamlToolbox
5 | {
6 | internal class ToolboxViewModel
7 | {
8 | public ToolboxViewModel()
9 | {
10 | LayoutItems = GetDefaultLayoutItems();
11 | ControlItems = GetDefaultControlItems();
12 | }
13 |
14 | // TODO: Support proper grouped item lists
15 | public ObservableCollection LayoutItems { get; set; }
16 |
17 | public ObservableCollection ControlItems { get; set; }
18 |
19 | // TODO: add validation tests of all default item content
20 | private ObservableCollection GetDefaultLayoutItems()
21 | {
22 | return new ObservableCollection {
23 | new ProToolboxItem
24 | {
25 | ImageMoniker = KnownMonikers.LayoutPanel,
26 | DisplayedText = "AbsoluteLayout",
27 | DefaultContent = "\r\n*|*\r\n",
28 | },
29 | new ProToolboxItem
30 | {
31 | ImageMoniker = KnownMonikers.BorderElement,
32 | DisplayedText = "Border",
33 | DefaultContent = "\r\n*|*\r\n",
34 | },
35 | new ProToolboxItem
36 | {
37 | ImageMoniker = KnownMonikers.Carousel,
38 | DisplayedText = "CarouselView",
39 | DefaultContent = "\r\n\r\n\r\n\r\n\r\n\r\n*|*\r\n\r\n\r\n",
40 | },
41 | new ProToolboxItem
42 | {
43 | ImageMoniker = KnownMonikers.ListView,
44 | DisplayedText = "CollectionView",
45 | DefaultContent = "\r\n\r\n\r\n*|*\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n",
46 | },
47 | new ProToolboxItem
48 | {
49 | ImageMoniker = KnownMonikers.FrameSet,
50 | DisplayedText = "ContentView",
51 | DefaultContent = "\r\n*|*\r\n",
52 | },
53 | new ProToolboxItem
54 | {
55 | ImageMoniker = KnownMonikers.FlowLayoutPanel,
56 | DisplayedText = "FlexLayout",
57 | DefaultContent = "\r\n*|*\r\n",
58 | },
59 | new ProToolboxItem
60 | {
61 | ImageMoniker = KnownMonikers.Grid,
62 | DisplayedText = "Grid",
63 | DefaultContent = "\r\n*|*\r\n",
64 | },
65 | new ProToolboxItem
66 | {
67 | ImageMoniker = KnownMonikers.AlignVerticalStretch,
68 | DisplayedText = "HorizontalStackLayout",
69 | DefaultContent = "\r\n*|*\r\n",
70 | },
71 | new ProToolboxItem
72 | {
73 | ImageMoniker = KnownMonikers.ListView,
74 | DisplayedText = "ListView",
75 | DefaultContent = "\r\n\r\n\r\n*|*\r\n\r\n\r\n",
76 | },
77 | new ProToolboxItem
78 | {
79 | ImageMoniker = KnownMonikers.Refresh,
80 | DisplayedText = "RefreshView",
81 | DefaultContent = "\r\n*|*\r\n",
82 | },
83 | new ProToolboxItem
84 | {
85 | ImageMoniker = KnownMonikers.ScrollBox,
86 | DisplayedText = "ScrollView",
87 | DefaultContent = "\r\n*|*\r\n",
88 | },
89 | new ProToolboxItem
90 | {
91 | ImageMoniker = KnownMonikers.TouchableDevice,
92 | DisplayedText = "SwipeView",
93 | DefaultContent = "\r\n\r\n\r\n*|*\r\n\r\n",
94 | },
95 | new ProToolboxItem
96 | {
97 | ImageMoniker = KnownMonikers.AppearanceGrid,
98 | DisplayedText = "TableView",
99 | DefaultContent = "\r\n\r\n*|*\r\n\r\n\r\n",
100 | },
101 | new ProToolboxItem
102 | {
103 | ImageMoniker = KnownMonikers.AlignHorizontalStretch,
104 | DisplayedText = "VerticalStackLayout",
105 | DefaultContent = "\r\n*|*\r\n",
106 | },
107 | };
108 | }
109 |
110 | private ObservableCollection GetDefaultControlItems()
111 | {
112 | return new ObservableCollection {
113 | new ProToolboxItem
114 | {
115 | ImageMoniker = KnownMonikers.Activity,
116 | DisplayedText = "ActivityIndicator",
117 | DefaultContent = "\r\n",
118 | },
119 | new ProToolboxItem
120 | {
121 | ImageMoniker = KnownMonikers.Box,
122 | DisplayedText = "BoxView",
123 | DefaultContent = "\r\n",
124 | },
125 | new ProToolboxItem
126 | {
127 | ImageMoniker = KnownMonikers.WebApplication,
128 | DisplayedText = "BlazorWebView",
129 | DefaultContent = "\r\n\r\n\r\n\r\n\r\n",
130 | },
131 | new ProToolboxItem
132 | {
133 | ImageMoniker = KnownMonikers.Button,
134 | DisplayedText = "Button",
135 | DefaultContent = "\r\n",
136 | },
137 | new ProToolboxItem
138 | {
139 | ImageMoniker = KnownMonikers.CheckBoxChecked,
140 | DisplayedText = "CheckBox",
141 | DefaultContent = "\r\n",
142 | },
143 | new ProToolboxItem
144 | {
145 | ImageMoniker = KnownMonikers.DateTimePicker,
146 | DisplayedText = "DatePicker",
147 | //DefaultContent = "\r\n",
148 | DefaultContent = "\r\n",
149 | },
150 | new ProToolboxItem
151 | {
152 | ImageMoniker = KnownMonikers.Editor,
153 | DisplayedText = "Editor",
154 | DefaultContent = "\r\n",
155 | },
156 | new ProToolboxItem
157 | {
158 | ImageMoniker = KnownMonikers.TextBox,
159 | DisplayedText = "Entry",
160 | DefaultContent = "\r\n",
161 | },
162 | new ProToolboxItem
163 | {
164 | ImageMoniker = KnownMonikers.ContentPlaceholder,
165 | DisplayedText = "GraphicsView",
166 | DefaultContent = "\r\n",
167 | },
168 | new ProToolboxItem
169 | {
170 | ImageMoniker = KnownMonikers.Image,
171 | DisplayedText = "Image",
172 | DefaultContent = "\r\n",
173 | },
174 | new ProToolboxItem
175 | {
176 | ImageMoniker = KnownMonikers.ImageButton,
177 | DisplayedText = "ImageButton",
178 | DefaultContent = "\r\n",
179 | },
180 | new ProToolboxItem
181 | {
182 | ImageMoniker = KnownMonikers.Label,
183 | DisplayedText = "Label",
184 | DefaultContent = "\r\n",
185 | },
186 | new ProToolboxItem
187 | {
188 | ImageMoniker = KnownMonikers.MapTileLayer,
189 | DisplayedText = "Map",
190 | DefaultContent = "\r\n\r\n",
191 | },
192 | new ProToolboxItem
193 | {
194 | ImageMoniker = KnownMonikers.PasswordBox,
195 | DisplayedText = "Password",
196 | DefaultContent = "\r\n",
197 | },
198 | new ProToolboxItem
199 | {
200 | ImageMoniker = KnownMonikers.Picker,
201 | DisplayedText = "Picker",
202 | DefaultContent = "\r\n",
203 | },
204 | new ProToolboxItem
205 | {
206 | ImageMoniker = KnownMonikers.ProgressBar,
207 | DisplayedText = "ProgressBar",
208 | DefaultContent = "\r\n",
209 | },
210 | new ProToolboxItem
211 | {
212 | ImageMoniker = KnownMonikers.RadioButton,
213 | DisplayedText = "RadioButton",
214 | DefaultContent = "\r\n",
215 | },
216 | new ProToolboxItem
217 | {
218 | ImageMoniker = KnownMonikers.Search,
219 | DisplayedText = "SearchBar",
220 | DefaultContent = "\r\n",
221 | },
222 | new ProToolboxItem
223 | {
224 | ImageMoniker = KnownMonikers.Slider,
225 | DisplayedText = "Slider",
226 | DefaultContent = "\r\n",
227 | },
228 | new ProToolboxItem
229 | {
230 | ImageMoniker = KnownMonikers.ButtonGroup,
231 | DisplayedText = "Stepper",
232 | DefaultContent = "\r\n",
233 | },
234 | new ProToolboxItem
235 | {
236 | ImageMoniker = KnownMonikers.ToggleButton,
237 | DisplayedText = "Switch",
238 | DefaultContent = "\r\n",
239 | },
240 | new ProToolboxItem
241 | {
242 | ImageMoniker = KnownMonikers.TimePicker,
243 | DisplayedText = "TimePicker",
244 | DefaultContent = "\r\n",
245 | },
246 | new ProToolboxItem
247 | {
248 | ImageMoniker = KnownMonikers.WebApplication,
249 | DisplayedText = "WebView",
250 | DefaultContent = "\r\n",
251 | },
252 | };
253 | }
254 | }
255 | }
256 |
--------------------------------------------------------------------------------
/src/ProXamlToolbox/VSPackage.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 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 |
122 | Resources\ProXamlToolboxWindowPackage.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
123 |
124 |
--------------------------------------------------------------------------------
/src/ProXamlToolbox/filestosign.txt:
--------------------------------------------------------------------------------
1 | ProXamlToolbox.dll
--------------------------------------------------------------------------------
/src/ProXamlToolbox/signvsix.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/ProXamlToolbox/source.extension.cs:
--------------------------------------------------------------------------------
1 | // ------------------------------------------------------------------------------
2 | //
3 | // This file was generated by VSIX Synchronizer
4 | //
5 | // ------------------------------------------------------------------------------
6 | namespace ProXamlToolbox
7 | {
8 | internal sealed partial class Vsix
9 | {
10 | public const string Id = "ProXamlToolbox.b9777a55-14f3-4600-adad-13ded99eaadf";
11 | public const string Name = "Pro XAML Toolbox";
12 | public const string Description = @"An experimental approach to the faster creation of XAML code in .NET MAUI projects";
13 | public const string Language = "en-US";
14 | public const string Version = "1.3";
15 | public const string Author = "Matt Lacey";
16 | public const string Tags = "XAML;MAUI;DotNetMaui";
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/ProXamlToolbox/source.extension.vsixmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Pro XAML Toolbox
6 | An experimental approach to the faster creation of XAML code in .NET MAUI projects
7 | https://github.com/mrlacey/ProXamlToolbox
8 | LICENSE.txt
9 | Resources\ProXamlToolbox.png
10 | XAML;MAUI;DotNetMaui
11 | true
12 |
13 |
14 |
17 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------