How to open images on default image viewer in WPF - wpf

I am binding my images which are coming from server in the listview .These images are bitmap images. When I click on any of the image from the listview I want it to open in the default Image-Viewer on Windows. Any way to achieve this ?

If there is a default viewer, there should be an association for the extension of the file. As a result, you can just shell-start the file. Use Process.Start like,
System.Diagnostics.Process.Start("imagePath");

Related

Is it possible to override the some of the UI of the default Chromium PDF viewer using CefSharp?

I'm trying to implement a PDF viewer for a Xamarin.Forms WPF application, and I'm using CefSharp to load and render the PDF file. However I've been unable to perform the necessary customizations on the default Chromium PDF Viewer, or PDFium, as far as my research goes.
This is what I need to change, and the image with the corresponding items:
A - Remove the toolbar.
B - Customize the scrollbar.
C - Remove the zoom items.
D - Change the background color.
I think that the scrollbar I might be able to change on the Xamarin side of things, the other items however, I'm quite sure I'll have to deal with PDFium or Chromium.
When I open a PDF file on Google chrome, I'm able to remove the toolbar and the zoom items using some simple JavaScript. This is the source that I see when I inspect the elements of the PDF viewer on Google Chrome:
Using these JavaScript statements in the Console Window I can remove the toolbar and zoom items (but only within Google Chrome:
Remover toolbar:
document.getElementById("toolbar").remove()
Remove zoom items:
document.getElementById("zoom-toolbar").remove()
This is the custom implementation of the CefSharp RenderProcessMessageHandler that I created in order to try to get to the source and run these JavaScript instructions and customize the control as I've been able to do within the Google Chrome browser:
class PdfRenderProcessMessageHandler : IRenderProcessMessageHandler
{
// <other methods required by the interface>
// Method called when the context is created
public void OnContextCreated(IWebBrowser browserControl, IBrowser browser, IFrame frame)
{
frame.ExecuteJavaScriptAsync("document.getElementById('toolbar').remove()");
frame.ExecuteJavaScriptAsync("document.getElementById('zoom - toolbar').remove()");
frame.ViewSource(); //Display the source code
}
}
However when I call the frame.ViewSoure() method to view the source code, this is the source code that I get:
So it seems pretty obvious that the code that I have when viewing a PDF file through Google Chrome and the code that I have when viewing the same file through CefSharp ChromiumWebBrowser it's pretty different.
Am I intercepting the source code at the wrong point, how can I have access to the full source when using CefSharp? Even if I can't change the background color (based on my research), removing the toolbar, zoom items and scrollbar could solve my problem.
Does anyone know how I might be able to achieve this?
I found a solution.
In XAML just use:
src="file.pdf#toolbar=0"
And in CodeBehind use:
browser.Load(pathToFile + "#toolbar=0");

background image in Sencha Architect

Using Sencha Architect, How to display background image ? I wanna see background image in design view, so I can snapshot. I have tried two ways:
First using CSS resources and background CSS Property, that works when app is saved and view in chrome but there is no background in SA Design View.
Second, I tried to place image (as background) but can't add buttons on that image.
Please help me to view background image in SA Design View. Thanks.
Have a look at this:
http://docs.sencha.com/architect/2/#!/guide/resources
Add your CSS file to your Architect project and it will apply in the design view like this:

is it possible to render a XAML canvas wihtout Silverlight?

Is it possible to create an online photo editor in XAML (editor allows users to add text, other images, clipart) that simply renders in a browser without the need for the user to download a plug in like Silverlight?
No. Closest would be using HTML5's canvas and javascript and/or jquery.

VS2010 MFC: Adding Standard File Toolbar w/o appWizard

I'm deep into a MFC project that I originally didn't think needed a toolbar, so I didn't have the app wizard put it in. Now I'm regretting it and I need the default new file and save file toolbar items. I know I can create a toolbar from the resource view but I can't figure out how to get the default images for those items. I tried the import option under add resource, but the imported image gets placed in a separate BMP Resource, not my toolbar resource. How do I get the default toolbar images?
The fastest way is to create a new empty project with a toolbar and to copy/paste from there all toolbar related code. Please let me know if you need farther assistance.

WinForms UserControl image resource

I am developing a user control and want to save an image as a part of that control. I added the image to the control resource, but I can not access the image using code (like Properties.Resources.etc) Any tips?
Found it.
In the Resource Editor one needs to select in the Access Modifiers drop-down list something other than No Code Generation.

Resources