WebView.NavigateToLocalStreamUri() method example for WPF WebView - c#

I could not find an example of WebView.NavigateToLocalStreamUri(Uri, IUriToStreamResolver) Method for WPF WebView.
All the examples, such as this and this, I've seen so far are for UWP Webview
Question: Can someone please either give or point to an example for WPF Webview where it shows how to load local web content (e.g. local html file) at the specified Uniform Resource Identifier (URI) using an IUriToStreamResolver?
Remark: I'm using latest versions of VS2019, .NET Core on Windows 10 Pro

Related

Printing a html in a Maui Blazor app running on Android not working

I have a Maui-Blazor app and I want to print a html (modal). The app should allow the user to print to PDF or any other format. The app runs inside Android.
I am using the following package for printing: https://github.com/Append-IT/Blazor.Printing.
However, when I run the app on Android, the print functionality does not work. I am not sure what the problem is and I would like help resolving this issue.
In Windows, printing works perfectly, but on Android, Do nothing
I have been searching for a solution to print a PDF or HTML in a Maui Blazor app running on Android. I came across a link (https://learn.microsoft.com/en-us/answers/questions/914868/how-to-print-pdf-html-in-maui) that suggests using the WebView class, but it does not provide a clear example of how to implement this in .NET and Blazor-Maui.
How can I use the WebView class to print a PDF or HTML in a Maui Blazor app running on Android? Can anyone provide a clear example or guide on how to implement this in .NET and Blazor-Maui?
or there is better opition ?

Is there any PDF Viewer in .NET MAUI App?

I am using .NET MAUI app for migrating my xamarin.forms into .NET MAUI. I have problem which i have to view pdf file in .NET MAUI app or in .NET MAUI Page as i previously did in Xamarin.Forms. I was using SfPdfViewer in Xamarin.Forms and it was working fine.
Kindly Help or guide please.
I want to View Pdf file in .Net Maui page in mobile app.
No, but hear me out. Search for PDF rendering instead.
Those viewers are doing a lot of useless work. In most cases you will want to simply scroll over the content of your PDF.
The way I achieve this is by rendering the PDF to images. And then using container to display them. You can set the DPI when rendering, so you don't make them too big (if you are using phone for example). You can implement some background loading, etc.
The end result is that you have something running at light speed.
As per their site, it looks like they don't have PDFViewer in MAUI. However, you should be able to integrate Blazor PDF Viewer into the MAUI app. Check out this documentation. I hope this helps.
https://blazor.syncfusion.com/documentation/getting-started/maui-blazor-app
#Muhammed Ali,
Greetings from Syncfusion!!
We have added PDF Viewer control in .NET MAUI to view PDF files in our latest Essential Studio 2022 Volume 4 Main Release V20.4.0.38. In this first release, we have provided support for displaying PDF files with page navigation and magnification functionalities. We will be adding more features to the control in our upcoming releases on a priority basis.
Please check our user guide and try this new PDF Viewer control in your application.
https://help.syncfusion.com/maui/pdf-viewer/overview

Proximity tap in WPF

I'm trying to detect nearby devices using NFC or RFID from within a WPF application.
Microsoft's proximity API seems to be the right way to go:
http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh465221.aspx
Unfortunately, I see no way to get it running inside a WPF application (or any other Desktop Technology that is). All examples refer to Microsoft store apps only.
From within a WPF application I cannot reference the Namespace
using Windows.Networking.Proximity;
Is it just a reference that I am missing? Is it possible to use the proximity API from a WPF application at all?
I finally found a sample project using the proximity API from within a WPF application:
http://code.msdn.microsoft.com/windowsdesktop/NFC-Editor-529ccda6
There is also a short tutorial included on how to use WinRT API's in WPF applications.
The basic steps:
Manually add a <TargetPlatformVersion>8.0</TargetPlatformVersion> line to the csproj file
Back in Visual Studio, add a reference to Windows/Core/Windows to the project references
Add a reference to the Windows Runtime assemblies to the project.
See above given link for details.
I believe that the Windows.Networking.Proximity.ProximityDevice class is not available in WPF Applications. If you look on the ProximityDevice class page on MSDN, you'll see that it is part of the Windows.Phone API:
The monitor image next to the phone image also leads me to believe that it is available for Windows Store Apps too. I'm guessing that (at present at least) the vast majority of desktop computers won't have any RFC hardware that could be used with this code and so that is why it is missing from the standard .NET dlls.
[2020 is here]
Procedure to prepare your Console/WPF project to call UWP APIs (both are OK):
https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/desktop-to-uwp-enhance
https://blogs.windows.com/windowsdeveloper/2019/09/30/windows-10-winrt-api-packs-released/
Heads up: You'll need to migrate the project from the packages.config management format to the PackageReference format
https://learn.microsoft.com/en-us/nuget/consume-packages/migrate-packages-config-to-package-reference#migration-steps

Web fonts and HTML5 Application cache feature in WPF WebView control (Metro)

I'm creating a metro application using C# and WPF.
I want to include a WebView for showing some web content. But the problem is, Some HTML5/CSS3 Features are not available in WebView, while they are available in IE10.
For example, WebView is not showing Web fonts, but IE10 does.
Also, html5test says that WebView does not support application cache (and some other features), while IE10 also supports application cache.
How to implement Web fonts and HTML5 Application cache in WPF WebView Control?
Think in WebView as a simple way to view web content. Sadly the WebView control is not a full featured IE10 and hence, it lacks of some functionality. I suggest you to simplify the input if you control webpage, or rethink the application features :(

Display svg in Metro App with c# and xaml

I'm working at a Windows 8 Metro Application with XAML and C#
I have got a Uri to a SVG Image, which really works, but I have no Idea how to get this Image and display it in the XAML.
Or is it impossible to work with SVG în .NET Core?
One way could be to convert the SVG to XAML paths - which you can display in any XAML view/control. I use this approach to show vector icons in my app. Do a quick search for SVG to(http://benpittoors.wordpress.com/2009/03/17/convert-svg-to-xaml/)
Or is it impossible to work with SVG în .NET Core?
The .NET Metro Profile is NOT the .NET 4.5 Full Profile or even the .NET Client Profile. One of the requirements or limitations of the Metro application is the inability to link to any content not compiled with Metro Profile.
I suggest you use WPF instead.

Categories