├── .editorconfig
├── .gitattributes
├── .github
└── workflows
│ ├── build.yml
│ └── publish.yml
├── .gitignore
├── LICENSE
├── NuGet.Config
├── Plugin.Maui.Dev.targets
├── Plugin.Maui.PoppedContentView.sln
├── README.md
├── nuget.png
├── sample
├── App.xaml
├── App.xaml.cs
├── AppShell.xaml
├── AppShell.xaml.cs
├── MainPage.xaml
├── MainPage.xaml.cs
├── MauiProgram.cs
├── Platforms
│ ├── Android
│ │ ├── AndroidManifest.xml
│ │ ├── MainActivity.cs
│ │ ├── MainApplication.cs
│ │ └── Resources
│ │ │ └── values
│ │ │ └── colors.xml
│ ├── MacCatalyst
│ │ ├── AppDelegate.cs
│ │ ├── Entitlements.Debug.plist
│ │ ├── Entitlements.Release.plist
│ │ ├── Info.plist
│ │ └── Program.cs
│ ├── Tizen
│ │ ├── Main.cs
│ │ └── tizen-manifest.xml
│ ├── Windows
│ │ ├── App.xaml
│ │ ├── App.xaml.cs
│ │ ├── Package.appxmanifest
│ │ └── app.manifest
│ └── iOS
│ │ ├── AppDelegate.cs
│ │ ├── Info.plist
│ │ └── Program.cs
├── Properties
│ └── launchSettings.json
├── Resources
│ ├── AppIcon
│ │ ├── appicon.svg
│ │ └── appiconfg.svg
│ ├── Fonts
│ │ ├── OpenSans-Regular.ttf
│ │ └── OpenSans-Semibold.ttf
│ ├── Images
│ │ └── dotnet_bot.svg
│ ├── Raw
│ │ └── AboutAssets.txt
│ ├── Splash
│ │ └── splash.svg
│ └── Styles
│ │ ├── Colors.xaml
│ │ └── Styles.xaml
├── Sample.csproj
├── SimplePoppedView.xaml
└── SimplePoppedView.xaml.cs
└── src
└── Plugin.Maui.PoppedContentView
├── IPoppedContentView.cs
├── IPoppedNavigationService.cs
├── Plugin.Maui.PoppedContentView.csproj
├── PoppedContentHandler.cs
├── PoppedContentView.cs
├── PoppedContentViewController.ios.maccatalyst.cs
├── PoppedHostExtensions.cs
├── PoppedNavigationService.android.cs
├── PoppedNavigationService.ios.maccatalyst.cs
├── PoppedNavigationService.net.cs
└── PoppedNavigationService.windows.cs
/.editorconfig:
--------------------------------------------------------------------------------
1 | # Suppress: EC112
2 | # top-most EditorConfig file
3 | root = true
4 |
5 | # Default settings:
6 | # A newline ending every file
7 | # Use tabs as indentation
8 | [*]
9 | insert_final_newline = false
10 | indent_style = tab
11 | indent_size = 4
12 |
13 | # Code files
14 | [*.{cs,csx,vb,vbx}]
15 | indent_style = tab
16 | indent_size = 4
17 |
18 | # Code files
19 | [*.sln]
20 | indent_size = 4
21 |
22 | # Xml project files
23 | [*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
24 | indent_size = 2
25 |
26 | # Xml config files
27 | [*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
28 | indent_size = 2
29 |
30 | # JSON files
31 | [*.json]
32 | indent_size = 2
33 |
34 | # XML files
35 | [*.xml]
36 | indent_size = 2
37 |
38 | [*.cs]
39 |
40 | # Organize usings
41 | dotnet_sort_system_directives_first = true
42 |
43 | # IDE0160: Use file scoped namespace
44 | csharp_style_namespace_declarations = file_scoped:error
45 |
46 | # CS4014: Because this call is not awaited, execution of the current method continues before the call is completed
47 | dotnet_diagnostic.CS4014.severity = error
48 |
49 | # Remove explicit default access modifiers
50 | dotnet_style_require_accessibility_modifiers = omit_if_default:error
51 |
52 | # CA1063: Implement IDisposable Correctly
53 | dotnet_diagnostic.CA1063.severity = error
54 |
55 | # Add braces (IDE0011)
56 | csharp_prefer_braces = true
57 | dotnet_diagnostic.IDE0011.severity = error
58 |
59 | # Pattern matching
60 | dotnet_style_object_initializer = true:suggestion
61 | dotnet_style_collection_initializer = true:suggestion
62 | dotnet_style_coalesce_expression = true:suggestion
63 | dotnet_style_null_propagation = true:suggestion
64 | dotnet_style_explicit_tuple_names = true:suggestion
65 | dotnet_style_prefer_is_null_check_over_reference_equality_method=true:suggestion
66 |
67 | csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
68 | csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
69 | csharp_style_inlined_variable_declaration = true:suggestion
70 | csharp_style_throw_expression = true:suggestion
71 | csharp_style_conditional_delegate_call = true:suggestions
72 |
73 | # Naming rules
74 |
75 | dotnet_diagnostic.IDE1006.severity = error
76 |
77 | ## Public Fields are kept Pascal Case
78 | dotnet_naming_symbols.public_symbols.applicable_kinds = field
79 | dotnet_naming_symbols.public_symbols.applicable_accessibilities = public
80 |
81 | dotnet_naming_style.first_word_upper_case_style.capitalization = first_word_upper
82 |
83 | dotnet_naming_rule.public_members_must_be_capitalized.symbols = public_symbols
84 | dotnet_naming_rule.public_members_must_be_capitalized.style = first_word_upper_case_style
85 | dotnet_naming_rule.public_members_must_be_capitalized.severity = suggestion
86 |
87 | ## Instance fields are camelCase
88 | dotnet_naming_rule.instance_fields_should_be_camel_case.severity = error
89 | dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
90 | dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style
91 |
92 | dotnet_naming_symbols.instance_fields.applicable_kinds = field
93 |
94 | dotnet_naming_style.instance_field_style.capitalization = camel_case
95 | dotnet_naming_style.instance_field_style.required_prefix =
96 |
97 | ## Static fields are camelCase
98 | dotnet_naming_rule.static_fields_should_be_camel_case.severity = error
99 | dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields
100 | dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style
101 |
102 | dotnet_naming_symbols.static_fields.applicable_kinds = field
103 | dotnet_naming_symbols.static_fields.required_modifiers = static
104 | dotnet_naming_symbols.static_fields.applicable_accessibilities = internal, private, protected, protected_internal, private_protected
105 |
106 | dotnet_naming_style.static_field_style.capitalization = camel_case
107 | dotnet_naming_style.static_field_style.required_prefix =
108 |
109 | # Modifier preferences
110 | csharp_prefer_static_local_function = true:suggestion
111 | csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:error
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/.github/workflows/build.yml:
--------------------------------------------------------------------------------
1 | name: Build
2 |
3 | on:
4 | push:
5 | branches: [ "main" ]
6 | paths-ignore:
7 | - "**.md"
8 | pull_request:
9 | branches: [ "main" ]
10 |
11 | jobs:
12 | build-plugin-ci:
13 |
14 | runs-on: windows-latest
15 |
16 | steps:
17 | - uses: actions/checkout@v3
18 | - name: Setup dotnet
19 | uses: actions/setup-dotnet@v3
20 | with:
21 | dotnet-version: 8.0.x
22 | - name: Setup MAUI
23 | run: dotnet workload install maui ios android maccatalyst
24 | - name: Build
25 | run: dotnet build ./Plugin.Maui.PoppedContentView.sln -c Release
26 |
--------------------------------------------------------------------------------
/.github/workflows/publish.yml:
--------------------------------------------------------------------------------
1 | name: Publish
2 | on:
3 | push:
4 | tags:
5 | - "[0-9]+.[0-9]+(.[0-9]+)?(-[a-z0-9]+)?"
6 | - "[0-9]+.[0-9]+(.[0-9]+)?(-[a-z]+\\.[0-9]+)?"
7 | jobs:
8 | release-nuget:
9 |
10 | runs-on: windows-latest
11 |
12 | steps:
13 | - uses: actions/checkout@v3
14 | - name: Verify commit exists in origin/main
15 | run: |
16 | git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
17 | git branch --remote --contains | grep origin/main
18 | - name: Get version information from tag
19 | id: get_version
20 | uses: battila7/get-version-action@v2
21 | - name: Setup dotnet
22 | uses: actions/setup-dotnet@v3
23 | with:
24 | dotnet-version: 8.0.x
25 | - name: Setup MAUI
26 | run: dotnet workload install maui ios android maccatalyst
27 | - name: Pack
28 | run: dotnet pack -c Release -p:PackageVersion=${{ steps.get_version.outputs.version-without-v }} --output ./artifacts src\Plugin.Maui.PoppedContentView\Plugin.Maui.PoppedContentView.csproj
29 | - name: Push
30 | run: dotnet nuget push ./artifacts/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_API_KEY }}
31 | env:
32 | GITHUB_TOKEN: ${{ secrets.NUGET_API_KEY }}
33 |
--------------------------------------------------------------------------------
/.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 | .DS_Store
400 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 Redth
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 |
--------------------------------------------------------------------------------
/NuGet.Config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Plugin.Maui.Dev.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | True
6 | True
7 | True
8 |
9 |
10 |
11 | Platforms\
12 | $([MSBuild]::EnsureTrailingSlash('$(PlatformsProjectFolder)'))
13 |
14 | $(PlatformsProjectFolder)Android\
15 | $([MSBuild]::EnsureTrailingSlash('$(AndroidProjectFolder)'))
16 |
17 | $(PlatformsProjectFolder)iOS\
18 | $([MSBuild]::EnsureTrailingSlash('$(iOSProjectFolder)'))
19 |
20 | $(PlatformsProjectFolder)MacCatalyst\
21 | $([MSBuild]::EnsureTrailingSlash('$(MacCatalystProjectFolder)'))
22 |
23 | $(PlatformsProjectFolder)Windows\
24 | $([MSBuild]::EnsureTrailingSlash('$(WindowsProjectFolder)'))
25 |
26 | $(PlatformsProjectFolder)Tizen\
27 | $([MSBuild]::EnsureTrailingSlash('$(TizenProjectFolder)'))
28 |
29 | $(PlatformsProjectFolder)Apple\
31 | $([MSBuild]::EnsureTrailingSlash('$(AppleProjectFolder)'))
32 |
33 | $(PlatformsProjectFolder)Net\
35 | $([MSBuild]::EnsureTrailingSlash('$(NetProjectFolder)'))
36 |
37 |
38 |
39 |
40 |
41 | False
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | True
50 | True
51 |
52 |
53 | True
54 | True
55 |
56 |
57 | True
58 | True
59 |
60 |
61 | True
62 | True
63 |
64 |
65 | True
66 | True
67 |
68 |
69 |
70 | True
71 | True
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 | True
82 | True
83 |
84 |
85 | True
86 | True
87 |
88 |
89 | True
90 | True
91 |
92 |
93 | True
94 | True
95 |
96 |
97 | True
98 | True
99 |
100 |
101 |
102 | True
103 | True
104 |
105 |
106 | True
107 | True
108 |
109 |
110 |
111 | True
112 | True
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 | True
123 |
124 |
125 |
126 |
129 | False
130 |
131 |
134 | False
135 |
136 |
139 | False
140 |
141 |
144 | False
145 |
146 |
149 | False
150 |
151 |
154 | False
155 |
156 |
157 |
158 |
159 |
161 | False
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
--------------------------------------------------------------------------------
/Plugin.Maui.PoppedContentView.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.8.34004.107
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Plugin.Maui.PoppedContentView", "src\Plugin.Maui.PoppedContentView\Plugin.Maui.PoppedContentView.csproj", "{32F7C965-4A66-477A-ACA8-E2D414D09C78}"
7 | EndProject
8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample", "sample\Sample.csproj", "{D3E944FA-3208-4C0E-BE87-8D3B5D9EA763}"
9 | EndProject
10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{AC3BA06C-626F-44A2-B55E-ADE1CAD31E95}"
11 | ProjectSection(SolutionItems) = preProject
12 | Plugin.Maui.Dev.targets = Plugin.Maui.Dev.targets
13 | EndProjectSection
14 | EndProject
15 | Global
16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
17 | Debug|Any CPU = Debug|Any CPU
18 | Release|Any CPU = Release|Any CPU
19 | EndGlobalSection
20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
21 | {32F7C965-4A66-477A-ACA8-E2D414D09C78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
22 | {32F7C965-4A66-477A-ACA8-E2D414D09C78}.Debug|Any CPU.Build.0 = Debug|Any CPU
23 | {32F7C965-4A66-477A-ACA8-E2D414D09C78}.Release|Any CPU.ActiveCfg = Release|Any CPU
24 | {32F7C965-4A66-477A-ACA8-E2D414D09C78}.Release|Any CPU.Build.0 = Release|Any CPU
25 | {D3E944FA-3208-4C0E-BE87-8D3B5D9EA763}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
26 | {D3E944FA-3208-4C0E-BE87-8D3B5D9EA763}.Debug|Any CPU.Build.0 = Debug|Any CPU
27 | {D3E944FA-3208-4C0E-BE87-8D3B5D9EA763}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
28 | {D3E944FA-3208-4C0E-BE87-8D3B5D9EA763}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 | {D3E944FA-3208-4C0E-BE87-8D3B5D9EA763}.Release|Any CPU.Build.0 = Release|Any CPU
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | GlobalSection(ExtensibilityGlobals) = postSolution
35 | SolutionGuid = {9C1A5250-4B63-4ABE-9E4A-65064808F863}
36 | EndGlobalSection
37 | EndGlobal
38 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
5 | 
6 | # Plugin.Maui.PoppedContentView
7 |
8 | `Plugin.Maui.PoppedContentView` is a simple control / service for presenting popup content in .NET MAUI apps.
9 |
10 | 
11 |
12 |
13 | ## Install Plugin
14 |
15 | [](https://www.nuget.org/packages/Plugin.Maui.PoppedContentView/)
16 |
17 | Available on [NuGet](http://www.nuget.org/packages/Plugin.Maui.PoppedContentView).
18 |
19 | Install with the dotnet CLI: `dotnet add package Plugin.Maui.PoppedContentView`, or through the NuGet Package Manager in Visual Studio.
20 |
21 | ## Setup
22 |
23 | In your _MauiProgram.cs_ file, call the `builder.UsePopped()` method on your builder to configure the plugin.
24 |
25 | In your app you can inject the `IPoppedNavigationService` as normally, or get it from the service provider manually, eg:
26 |
27 | ```csharp
28 | this.Handler.MauiContext.Services.GetService();
29 | ```
30 |
31 | ## Usage
32 |
33 | Once you have an instance of the service, you can show popups:
34 |
35 | ```csharp
36 | await poppedNavService.ShowAsync(this.Window, new SimplePoppedView());
37 | ```
38 |
39 | The first argument is an `IWindow` which should be the window you would like to present the popup within. The second argument is an `IPoppedContentView`. The easiest way to create this is to make a new control which subclasses the `PoppedContentView` implementation, eg:
40 |
41 | ```xaml
42 |
43 |
47 |
48 |
49 |
50 |
54 |
55 |
56 |
57 | ```
58 |
59 | The `PoppedContentView` is just a subclass of `ContentView` which implements a couple more methods such as `PoppingInAsync()` and `PoppingOutAsync()`.
60 |
61 | ## Closing
62 |
63 | There's no built in mechanism for closing when the background of the popup is tapped. You can wire this up yourself with a Tap gesture recognizer on your view(s) and then calling the `HideAsync(IPoppedContentView)` method.
64 |
65 | ## Animations
66 |
67 | Currently there is no built-in animations. You can however accomplish them using the MAUI animation API's from within the `PoppingInAsync()` and `PoppingOutAsync()` methods (the sample shows how to do this).
68 |
69 |
70 |
--------------------------------------------------------------------------------
/nuget.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Redth/Plugin.Maui.PoppedContentView/d47c5f5dd420534765bba11d93aa80b93fed3076/nuget.png
--------------------------------------------------------------------------------
/sample/App.xaml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/sample/App.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace Sample;
2 |
3 | public partial class App : Application
4 | {
5 | public App()
6 | {
7 | InitializeComponent();
8 |
9 | MainPage = new AppShell();
10 | }
11 | }
12 |
13 |
--------------------------------------------------------------------------------
/sample/AppShell.xaml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/sample/AppShell.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace Sample;
2 |
3 | public partial class AppShell : Shell
4 | {
5 | public AppShell()
6 | {
7 | InitializeComponent();
8 | }
9 | }
10 |
11 |
--------------------------------------------------------------------------------
/sample/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
11 |
12 |
17 |
18 |
23 |
24 |
30 |
31 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/sample/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace Sample;
2 |
3 | public partial class MainPage : ContentPage
4 | {
5 | int count = 0;
6 |
7 | public MainPage()
8 | {
9 | InitializeComponent();
10 |
11 | PoppedNavigation = MauiProgram.Services.GetService();
12 |
13 | }
14 |
15 | readonly Maui.Popped.IPoppedNavigationService PoppedNavigation;
16 |
17 |
18 | private async void OnCounterClicked(object sender, EventArgs e)
19 | {
20 | await PoppedNavigation.ShowAsync(this.Window, new SimplePoppedView(this.Window));
21 | }
22 | }
23 |
24 |
25 |
--------------------------------------------------------------------------------
/sample/MauiProgram.cs:
--------------------------------------------------------------------------------
1 | using Maui.Popped;
2 | using Microsoft.Extensions.Logging;
3 |
4 | namespace Sample;
5 |
6 | public static class MauiProgram
7 | {
8 | public static MauiApp App { get; private set; }
9 | public static IServiceProvider Services { get; private set; }
10 |
11 | public static MauiApp CreateMauiApp()
12 | {
13 | var builder = MauiApp.CreateBuilder();
14 | builder
15 | .UseMauiApp()
16 | .ConfigureFonts(fonts =>
17 | {
18 | fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
19 | fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
20 | });
21 |
22 | builder.UsePopped();
23 |
24 | App = builder.Build();
25 | Services = App.Services;
26 | return App;
27 | }
28 | }
29 |
30 |
--------------------------------------------------------------------------------
/sample/Platforms/Android/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/sample/Platforms/Android/MainActivity.cs:
--------------------------------------------------------------------------------
1 | using Android.App;
2 | using Android.Content.PM;
3 | using Android.OS;
4 |
5 | namespace Sample;
6 |
7 | [Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
8 | public class MainActivity : MauiAppCompatActivity
9 | {
10 | }
11 |
12 |
--------------------------------------------------------------------------------
/sample/Platforms/Android/MainApplication.cs:
--------------------------------------------------------------------------------
1 | using Android.App;
2 | using Android.Runtime;
3 |
4 | namespace Sample;
5 |
6 | [Application]
7 | public class MainApplication : MauiApplication
8 | {
9 | public MainApplication(IntPtr handle, JniHandleOwnership ownership)
10 | : base(handle, ownership)
11 | {
12 | }
13 |
14 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
15 | }
16 |
17 |
--------------------------------------------------------------------------------
/sample/Platforms/Android/Resources/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #512BD4
4 | #2B0B98
5 | #2B0B98
6 |
7 |
--------------------------------------------------------------------------------
/sample/Platforms/MacCatalyst/AppDelegate.cs:
--------------------------------------------------------------------------------
1 | using Foundation;
2 |
3 | namespace Sample;
4 |
5 | [Register("AppDelegate")]
6 | public class AppDelegate : MauiUIApplicationDelegate
7 | {
8 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
9 | }
10 |
11 |
--------------------------------------------------------------------------------
/sample/Platforms/MacCatalyst/Entitlements.Debug.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | com.apple.security.get-task-allow
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/sample/Platforms/MacCatalyst/Entitlements.Release.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | com.apple.security.app-sandbox
7 |
8 | com.apple.security.network.client
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/sample/Platforms/MacCatalyst/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | UIDeviceFamily
15 |
16 | 2
17 |
18 | UIRequiredDeviceCapabilities
19 |
20 | arm64
21 |
22 | UISupportedInterfaceOrientations
23 |
24 | UIInterfaceOrientationPortrait
25 | UIInterfaceOrientationLandscapeLeft
26 | UIInterfaceOrientationLandscapeRight
27 |
28 | UISupportedInterfaceOrientations~ipad
29 |
30 | UIInterfaceOrientationPortrait
31 | UIInterfaceOrientationPortraitUpsideDown
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | XSAppIconAssets
36 | Assets.xcassets/appicon.appiconset
37 |
38 |
39 |
--------------------------------------------------------------------------------
/sample/Platforms/MacCatalyst/Program.cs:
--------------------------------------------------------------------------------
1 | using ObjCRuntime;
2 | using UIKit;
3 |
4 | namespace Sample;
5 |
6 | public class Program
7 | {
8 | // This is the main entry point of the application.
9 | static void Main(string[] args)
10 | {
11 | // if you want to use a different Application Delegate class from "AppDelegate"
12 | // you can specify it here.
13 | UIApplication.Main(args, null, typeof(AppDelegate));
14 | }
15 | }
16 |
17 |
--------------------------------------------------------------------------------
/sample/Platforms/Tizen/Main.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.Maui;
3 | using Microsoft.Maui.Hosting;
4 |
5 | namespace Sample;
6 |
7 | class Program : MauiApplication
8 | {
9 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
10 |
11 | static void Main(string[] args)
12 | {
13 | var app = new Program();
14 | app.Run(args);
15 | }
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/sample/Platforms/Tizen/tizen-manifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | maui-appicon-placeholder
7 |
8 |
9 |
10 |
11 | http://tizen.org/privilege/internet
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/sample/Platforms/Windows/App.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/sample/Platforms/Windows/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.UI.Xaml;
2 |
3 | // To learn more about WinUI, the WinUI project structure,
4 | // and more about our project templates, see: http://aka.ms/winui-project-info.
5 |
6 | namespace Sample.WinUI;
7 |
8 | ///
9 | /// Provides application-specific behavior to supplement the default Application class.
10 | ///
11 | public partial class App : MauiWinUIApplication
12 | {
13 | ///
14 | /// Initializes the singleton application object. This is the first line of authored code
15 | /// executed, and as such is the logical equivalent of main() or WinMain().
16 | ///
17 | public App()
18 | {
19 | this.InitializeComponent();
20 | }
21 |
22 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
23 | }
24 |
25 |
26 |
--------------------------------------------------------------------------------
/sample/Platforms/Windows/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | $placeholder$
15 | User Name
16 | $placeholder$.png
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/sample/Platforms/Windows/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
11 | true/PM
12 | PerMonitorV2, PerMonitor
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/sample/Platforms/iOS/AppDelegate.cs:
--------------------------------------------------------------------------------
1 | using Foundation;
2 |
3 | namespace Sample;
4 |
5 | [Register("AppDelegate")]
6 | public class AppDelegate : MauiUIApplicationDelegate
7 | {
8 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
9 | }
10 |
11 |
--------------------------------------------------------------------------------
/sample/Platforms/iOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | LSRequiresIPhoneOS
6 |
7 | UIDeviceFamily
8 |
9 | 1
10 | 2
11 |
12 | UIRequiredDeviceCapabilities
13 |
14 | arm64
15 |
16 | UISupportedInterfaceOrientations
17 |
18 | UIInterfaceOrientationPortrait
19 | UIInterfaceOrientationLandscapeLeft
20 | UIInterfaceOrientationLandscapeRight
21 |
22 | UISupportedInterfaceOrientations~ipad
23 |
24 | UIInterfaceOrientationPortrait
25 | UIInterfaceOrientationPortraitUpsideDown
26 | UIInterfaceOrientationLandscapeLeft
27 | UIInterfaceOrientationLandscapeRight
28 |
29 | XSAppIconAssets
30 | Assets.xcassets/appicon.appiconset
31 |
32 |
33 |
--------------------------------------------------------------------------------
/sample/Platforms/iOS/Program.cs:
--------------------------------------------------------------------------------
1 | using ObjCRuntime;
2 | using UIKit;
3 |
4 | namespace Sample;
5 |
6 | public class Program
7 | {
8 | // This is the main entry point of the application.
9 | static void Main(string[] args)
10 | {
11 | // if you want to use a different Application Delegate class from "AppDelegate"
12 | // you can specify it here.
13 | UIApplication.Main(args, null, typeof(AppDelegate));
14 | }
15 | }
16 |
17 |
--------------------------------------------------------------------------------
/sample/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "Windows Machine": {
4 | "commandName": "MsixPackage",
5 | "nativeDebugging": false
6 | }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/sample/Resources/AppIcon/appicon.svg:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/sample/Resources/AppIcon/appiconfg.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
--------------------------------------------------------------------------------
/sample/Resources/Fonts/OpenSans-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Redth/Plugin.Maui.PoppedContentView/d47c5f5dd420534765bba11d93aa80b93fed3076/sample/Resources/Fonts/OpenSans-Regular.ttf
--------------------------------------------------------------------------------
/sample/Resources/Fonts/OpenSans-Semibold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Redth/Plugin.Maui.PoppedContentView/d47c5f5dd420534765bba11d93aa80b93fed3076/sample/Resources/Fonts/OpenSans-Semibold.ttf
--------------------------------------------------------------------------------
/sample/Resources/Images/dotnet_bot.svg:
--------------------------------------------------------------------------------
1 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/sample/Resources/Raw/AboutAssets.txt:
--------------------------------------------------------------------------------
1 | Any raw assets you want to be deployed with your application can be placed in
2 | this directory (and child directories). Deployment of the asset to your application
3 | is automatically handled by the following `MauiAsset` Build Action within your `.csproj`.
4 |
5 |
6 |
7 | These files will be deployed with you package and will be accessible using Essentials:
8 |
9 | async Task LoadMauiAsset()
10 | {
11 | using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt");
12 | using var reader = new StreamReader(stream);
13 |
14 | var contents = reader.ReadToEnd();
15 | }
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/sample/Resources/Splash/splash.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
--------------------------------------------------------------------------------
/sample/Resources/Styles/Colors.xaml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
9 | #512BD4
10 | #DFD8F7
11 | #2B0B98
12 | White
13 | Black
14 | #E1E1E1
15 | #C8C8C8
16 | #ACACAC
17 | #919191
18 | #6E6E6E
19 | #404040
20 | #212121
21 | #141414
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | #F7B548
37 | #FFD590
38 | #FFE5B9
39 | #28C2D1
40 | #7BDDEF
41 | #C3F2F4
42 | #3E8EED
43 | #72ACF1
44 | #A7CBF6
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/sample/Resources/Styles/Styles.xaml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
10 |
11 |
15 |
16 |
21 |
22 |
25 |
26 |
51 |
52 |
69 |
70 |
90 |
91 |
112 |
113 |
134 |
135 |
140 |
141 |
162 |
163 |
181 |
182 |
186 |
187 |
209 |
210 |
225 |
226 |
246 |
247 |
250 |
251 |
274 |
275 |
295 |
296 |
302 |
303 |
322 |
323 |
326 |
327 |
355 |
356 |
376 |
377 |
381 |
382 |
394 |
395 |
400 |
401 |
407 |
408 |
409 |
410 |
--------------------------------------------------------------------------------
/sample/Sample.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0-maccatalyst;net8.0-ios;net8.0-android
5 | $(TargetFrameworks);net8.0-windows10.0.19041.0
6 |
7 |
8 |
9 |
14 |
15 |
16 | Exe
17 | Sample
18 | true
19 | true
20 | enable
21 |
22 |
23 | Sample
24 |
25 |
26 | com.companyname.sample
27 |
28 |
29 | 1.0
30 | 1
31 |
32 | 11.0
33 | 13.1
34 | 21.0
35 | 10.0.17763.0
36 | 10.0.17763.0
37 | 6.5
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
66 |
67 |
68 |
69 |
70 | Platforms/MacCatalyst/Entitlements.Debug.plist
71 |
72 |
73 |
74 | Platforms/MacCatalyst/Entitlements.Release.plist
75 | true
76 |
77 |
78 | false
79 |
80 |
81 | false
82 | Platforms\MacCatalyst\Entitlements.Debug.plist
83 |
84 |
85 |
--------------------------------------------------------------------------------
/sample/SimplePoppedView.xaml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/sample/SimplePoppedView.xaml.cs:
--------------------------------------------------------------------------------
1 | using Maui.Popped;
2 | using Microsoft.Maui.Controls;
3 |
4 | namespace Sample;
5 |
6 | public partial class SimplePoppedView : Maui.Popped.PoppedContentView
7 | {
8 | public SimplePoppedView(IWindow window)
9 | {
10 | InitializeComponent();
11 |
12 | TheWindow = window;
13 | }
14 |
15 | public readonly IWindow TheWindow;
16 |
17 | public override Task PoppingInAsync()
18 | {
19 | var contentSize = this.Content.Measure(TheWindow.Width, TheWindow.Height, MeasureFlags.IncludeMargins);
20 |
21 | var contentHeight = contentSize.Request.Height; // (this.TheWindow?.Height ?? 0);
22 |
23 | this.Content.TranslationY = contentHeight;
24 |
25 | this.Animate("BG", v =>
26 | {
27 | this.Background = new SolidColorBrush(Colors.Black.WithAlpha((float)v));
28 |
29 | }, 0d, 0.7d, 32, 350, easing: Easing.CubicOut, finished: (v, k) =>
30 | {
31 | this.Background = new SolidColorBrush(Colors.Black.WithAlpha(0.7f));
32 | });
33 |
34 | this.Animate("TL", v =>
35 | {
36 | var t = (contentHeight - v);
37 | this.Content.TranslationY = (int)t;
38 | }, 0, contentHeight, length: 500, easing: Easing.CubicInOut, finished: (v, k) =>
39 | {
40 | this.Content.TranslationY = 0;
41 | });
42 |
43 |
44 | return Task.CompletedTask;
45 | }
46 |
47 | public override Task PoppingOutAsync()
48 | {
49 | var done = new TaskCompletionSource();
50 |
51 | var contentSize = this.Content.Measure(TheWindow.Width, TheWindow.Height, MeasureFlags.IncludeMargins);
52 |
53 | var windowHeight = contentSize.Request.Height; // (this.TheWindow?.Height ?? 0);
54 |
55 | this.Animate("BG", v =>
56 | {
57 | this.Background = new SolidColorBrush(Colors.Black.WithAlpha((float)v));
58 |
59 | }, 0.7d, 0d, 32, 350, easing: Easing.CubicIn, finished: (v, k) =>
60 | {
61 | this.Background = new SolidColorBrush(Colors.Black.WithAlpha(0.0f));
62 | });
63 |
64 | this.Animate("TL", v =>
65 | {
66 | var t = (windowHeight - v);
67 | Console.WriteLine("TranslationY : " + t);
68 |
69 | this.Content.TranslationY = (int)t;
70 | }, windowHeight, 0, length: 500, easing: Easing.CubicInOut, finished: (v, k) =>
71 | {
72 | this.Content.TranslationY = windowHeight;
73 | done.TrySetResult();
74 | });
75 |
76 | return done.Task;
77 | }
78 |
79 | void TapGestureRecognizer_Tapped(System.Object sender, Microsoft.Maui.Controls.TappedEventArgs e)
80 | {
81 | var nav = this.Handler.MauiContext.Services.GetRequiredService();
82 |
83 | nav.HideAsync(this);
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/src/Plugin.Maui.PoppedContentView/IPoppedContentView.cs:
--------------------------------------------------------------------------------
1 | namespace Maui.Popped;
2 |
3 | public interface IPoppedContentView : IView
4 | {
5 | Task PoppingInAsync();
6 |
7 | Task PoppingOutAsync();
8 | }
9 |
--------------------------------------------------------------------------------
/src/Plugin.Maui.PoppedContentView/IPoppedNavigationService.cs:
--------------------------------------------------------------------------------
1 | namespace Maui.Popped;
2 |
3 | public interface IPoppedNavigationService
4 | {
5 | Task ShowAsync(IWindow fromWindow, IPoppedContentView content);
6 | Task HideAsync(IPoppedContentView content);
7 | }
8 |
--------------------------------------------------------------------------------
/src/Plugin.Maui.PoppedContentView/Plugin.Maui.PoppedContentView.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net8.0-android;net8.0-ios;net8.0-maccatalyst;net8.0
4 | $(TargetFrameworks);net8.0-windows10.0.19041.0
5 |
6 |
7 | true
8 | enable
9 | enable
10 | true
11 |
12 | 14.2
13 | 14.0
14 | 21.0
15 | 10.0.17763.0
16 | 10.0.17763.0
17 | 6.5
18 |
19 |
20 | redth
21 | Copyright © redth
22 | True
23 | https://github.com/redth/Plugin.Maui.PoppedContentView
24 | https://github.com/redth/Plugin.Maui.PoppedContentView
25 | git
26 | dotnet-maui;maui;plugin;
27 | True
28 | true
29 | true
30 | snupkg
31 | .NET MAUI Feature Plugin
32 | Simple Popup control and service for .NET MAUI
33 | MIT
34 | True
35 | portable
36 | icon.png
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/src/Plugin.Maui.PoppedContentView/PoppedContentHandler.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Maui.Handlers;
2 |
3 |
4 | namespace Maui.Popped;
5 |
6 | public partial class PoppedContentHandler : ContentViewHandler
7 | {
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/src/Plugin.Maui.PoppedContentView/PoppedContentView.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Maui.Handlers;
2 |
3 | namespace Maui.Popped;
4 |
5 | public class PoppedContentView : ContentView, IPoppedContentView
6 | {
7 | public virtual Task PoppingInAsync()
8 | {
9 | return Task.CompletedTask;
10 | }
11 |
12 | public virtual Task PoppingOutAsync()
13 | {
14 | return Task.CompletedTask;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Plugin.Maui.PoppedContentView/PoppedContentViewController.ios.maccatalyst.cs:
--------------------------------------------------------------------------------
1 | using UIKit;
2 | using Microsoft.Maui.Platform;
3 |
4 | namespace Maui.Popped;
5 |
6 | class PoppedContentViewController : UIViewController
7 | {
8 | public PoppedContentViewController(IMauiContext context, IPoppedContentView content)
9 | : base()
10 | {
11 | Content = content;
12 |
13 | this.View = content.ToPlatform(context);
14 | }
15 |
16 | public readonly IPoppedContentView Content;
17 |
18 | public override void ViewWillAppear(bool animated)
19 | {
20 | base.ViewWillAppear(animated);
21 |
22 | _ = Content.PoppingInAsync();
23 | }
24 | }
25 |
26 |
--------------------------------------------------------------------------------
/src/Plugin.Maui.PoppedContentView/PoppedHostExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace Maui.Popped;
2 |
3 | public static class PoppedHostExtensions
4 | {
5 | public static MauiAppBuilder UsePopped(this MauiAppBuilder builder)
6 | {
7 | builder.ConfigureMauiHandlers(h => h.AddHandler());
8 | builder.Services.AddPopped();
9 | return builder;
10 | }
11 |
12 | public static IServiceCollection AddPopped(this IServiceCollection services)
13 | {
14 | services.AddSingleton();
15 | return services;
16 | }
17 | }
--------------------------------------------------------------------------------
/src/Plugin.Maui.PoppedContentView/PoppedNavigationService.android.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Microsoft.Maui.Platform;
3 |
4 | namespace Maui.Popped;
5 |
6 | public class PoppedNavigationService : IPoppedNavigationService
7 | {
8 | public async Task HideAsync(IPoppedContentView content)
9 | {
10 | var platformView = content?.Handler?.PlatformView as Android.Views.View;
11 |
12 | if (content is not null)
13 | {
14 | await content.PoppingOutAsync();
15 | }
16 |
17 | platformView?.RemoveFromParent();
18 |
19 | if (content?.Handler is not null)
20 | {
21 | content.Handler.DisconnectHandler();
22 | content.Handler = null;
23 | }
24 | }
25 |
26 | public async Task ShowAsync(IWindow fromWindow, IPoppedContentView content)
27 | {
28 | var activity = fromWindow.Handler?.PlatformView as Android.App.Activity;
29 |
30 | if (activity?.Window?.DecorView is Android.Widget.FrameLayout frameLayout)
31 | {
32 | if (fromWindow?.Handler?.MauiContext is not null)
33 | {
34 | var platformView = content.ToPlatform(fromWindow.Handler.MauiContext);
35 |
36 | frameLayout.AddView(platformView);
37 |
38 | await content.PoppingInAsync();
39 |
40 | if (fromWindow is Element windowElement && content is Element contentElement)
41 | {
42 | windowElement.AddLogicalChild(contentElement);
43 | }
44 | }
45 |
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/Plugin.Maui.PoppedContentView/PoppedNavigationService.ios.maccatalyst.cs:
--------------------------------------------------------------------------------
1 | using CoreGraphics;
2 | using UIKit;
3 | using Microsoft.Maui.Controls.PlatformConfiguration;
4 |
5 | namespace Maui.Popped;
6 |
7 | public class PoppedNavigationService : IPoppedNavigationService
8 | {
9 | Dictionary popped = new();
10 |
11 | public async Task HideAsync(IPoppedContentView content)
12 | {
13 | if (popped.TryGetValue(content, out var vc) && content is not null)
14 | {
15 | await content.PoppingOutAsync();
16 |
17 | await vc.DismissViewControllerAsync(false);
18 | popped.Remove(content);
19 |
20 | vc.Dispose();
21 | content.Handler?.DisconnectHandler();
22 | content.Handler = null;
23 | }
24 | }
25 |
26 | public async Task ShowAsync(IWindow fromWindow, IPoppedContentView content)
27 | {
28 | var uiWindow = fromWindow?.Handler?.PlatformView as UIWindow;
29 |
30 | if (fromWindow?.Handler?.MauiContext is not null && uiWindow is not null)
31 | {
32 | var vc = new PoppedContentViewController(fromWindow.Handler.MauiContext, content);
33 | vc.ModalPresentationStyle = UIModalPresentationStyle.OverFullScreen;
34 |
35 | if (uiWindow.RootViewController is not null)
36 | {
37 | await uiWindow.RootViewController.PresentViewControllerAsync(vc, false);
38 | }
39 |
40 | popped.Add(content, vc);
41 |
42 | if (fromWindow is Element windowElement && content is Element contentElement)
43 | {
44 | windowElement.AddLogicalChild(contentElement);
45 | }
46 | }
47 | }
48 | }
49 |
50 |
--------------------------------------------------------------------------------
/src/Plugin.Maui.PoppedContentView/PoppedNavigationService.net.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Microsoft.Maui.Platform;
3 |
4 | namespace Maui.Popped;
5 |
6 | #if !IOS && !MACCATALYST && !ANDROID && !WINDOWS
7 | public class PoppedNavigationService : IPoppedNavigationService
8 | {
9 | public Task HideAsync(IPoppedContentView content)
10 | => Task.CompletedTask;
11 |
12 | public Task ShowAsync(IWindow fromWindow, IPoppedContentView content)
13 | => Task.CompletedTask;
14 | }
15 | #endif
--------------------------------------------------------------------------------
/src/Plugin.Maui.PoppedContentView/PoppedNavigationService.windows.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Microsoft.Maui.Controls.PlatformConfiguration;
3 | using Microsoft.Maui.Platform;
4 | using Microsoft.UI.Xaml;
5 | using Microsoft.UI.Xaml.Controls.Primitives;
6 |
7 | namespace Maui.Popped;
8 |
9 | public class PoppedNavigationService : IPoppedNavigationService
10 | {
11 | Dictionary WindowSizeHandler)> popped = new();
12 |
13 | public async Task HideAsync(IPoppedContentView content)
14 | {
15 | if (popped.TryGetValue(content, out var info) && content is not null)
16 | {
17 | await content.PoppingOutAsync();
18 |
19 | info.Popup.Child = null;
20 | info.Popup.IsOpen = false;
21 |
22 | popped.Remove(content);
23 |
24 | info.XamlWindow.SizeChanged -= info.WindowSizeHandler;
25 |
26 | content.Handler?.DisconnectHandler();
27 | content.Handler = null;
28 | }
29 | }
30 |
31 | public async Task ShowAsync(IWindow fromWindow, IPoppedContentView content)
32 | {
33 | var window = fromWindow.Handler?.PlatformView as Microsoft.UI.Xaml.Window;
34 |
35 | if (window is not null)
36 | {
37 | if (fromWindow?.Handler?.MauiContext is not null)
38 | {
39 | var platformView = content.ToPlatform(fromWindow.Handler.MauiContext);
40 |
41 | window.SizeChanged += Window_SizeChanged;
42 |
43 | void Window_SizeChanged(object sender, WindowSizeChangedEventArgs args)
44 | {
45 | platformView.Width = window.Bounds.Width;
46 | platformView.Height = window.Bounds.Height;
47 | }
48 |
49 | platformView.HorizontalAlignment = Microsoft.UI.Xaml.HorizontalAlignment.Stretch;
50 | platformView.VerticalAlignment = Microsoft.UI.Xaml.VerticalAlignment.Stretch;
51 | platformView.Width = window.Bounds.Width;
52 | platformView.Height = window.Bounds.Height;
53 |
54 | var popup = new Popup();
55 | popup.Child = platformView;
56 | popup.XamlRoot = window.Content.XamlRoot;
57 |
58 | popup.IsOpen = true;
59 |
60 | platformView.InvalidateMeasure();
61 | popup.InvalidateMeasure();
62 |
63 | await content.PoppingInAsync();
64 |
65 | popped.Add(content, (popup, window, Window_SizeChanged));
66 |
67 | if (fromWindow is Element windowElement && content is Element contentElement)
68 | {
69 | windowElement.AddLogicalChild(contentElement);
70 | }
71 | }
72 |
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------