create application like simple PowerPoint in c# wpf? - wpf

I want to create create application like simple PowerPoint in c# WPF, I meant exactly that I want to create page like slides and can arrange in time line with various speed and transition and can seeing in preview panel.I tries on Microsoft PowerPoint interoperability but as I found It just create PowerPoint file not provide framework to interact!!.
Please show me sample code or sample way to-do or how do it?

One method I have used is to have a WPF WebBrowser control and then navigate to a pptx file. This will open PowerPoint inside the WebBrowser control. You will not be able to interact with the PowerPoint application from your WPF host, but that is about as good as it gets.

Try this control from syncfusion: http://www.syncfusion.com/products/file-formats/presentation. They now offer a free community version with all if their controls.

Related

Best Starting Point for WPF Revit Add in

I am wanting to rewrite one of my Revit Add ins so that it utilizes WPF with MVVM because I like the look and functionality of WPF better than Windows Forms.
I have used the Revit Template Wizzard from Jeremy Tammik for the Form based add in, but adding a WPF user control seems not to work (a run time error that the xaml resource cannot be found).
I found a WPF MVVM revit add in example (AddMaterials, here is the github link, which will add materials from an Excel spreadsheet) but it does not follow what I am expecting to see at the top level.
Revit Add ins have an app.cs file which tells Revit how to register and access the DLL (ribbon panel buttons etc).
A windows WPF app will have app.xaml as the top level entry point.
The Add Materials project has neither which tells me that it must be
a class library, however the views are not using UserControls
rather they are Windows which I prefer. However Visual Studio does not
let you add a Window for a Class Library type project.
The third issue is easily solved by simply copying windows from a WPF application project into a class library project. But I don't really understand how the class library will instantiate in Revit without following the app.cs code from the template. Is anyone else creating add-ins this way, and if so can you let me in on any tricks or discussions that will help? Has anyone created a WPF Revit addin template for Visual Studio?
When I add a WPF window and try to instantiate it I get an error that it cannot find the xaml resource (System.IO.IOException: Cannot locate resource 'xxxx.xaml'). I have tried to fix this according to advice found when googling for this error, but to no avail. I am thinking it comes from being in a form based project, and that I may have to just start with a new project without the form stuff.
I have now verified that indeed you can start with the Revit AddIn Wizzard and use WPF . . . I started from scratch and copied in a window created in another project and got it to run (after adding the various references, namespaces, etc). So my problem seems to just be with the original project which already had a bunch of form stuff added.
Yes, I'm using WPF to create Revit Addins. It works well. You can easily create your own WPF template from the SDK samples:
Start with one of the Autodesk-provided SDK samples. I used the "DockableDialogs" sample. I know this one works, your mileage may vary with the others. If you're looking for windows rather than docked panes in the UI, another sample (perhaps the AddMaterials sample) is probably simpler.
I used Visual Studio to turn the sample into a template. File - Export Template -> select "DockableDialogs" or other WPF sample project.
Create a new project based on the template you just created. This was the easiest method I could find to get the WPF internal bits wired up correctly.
I'm not specifically familiar with the AddMaterials project, but to clarify your bullet points.
Revit Addins - It's not the file name (app.cs) but rather they must extend IExternalApplication or IExternalCommand. If you are creating a xaml interface (rather than just running a command from a ribbon button) you'll use 'IExternalApplication' as your entry point. Look for something like this in the sample:
public class ThisApplication : IExternalApplication ...
I don't used a top level app.xaml, but instead have page.xaml pages which are called by the Revit app. In my case these are Pages rather than Windows, which extend the IDockablePaneProvider class. These must be registered with the application which can then can be show, hide, etc your Panes. I imagine this is simpler with Windows, but haven't done it myself. For the dockable panes, your xaml.cs should start out something like:
public partial class MainPage : Page, Autodesk.Revit.UI.IDockablePaneProvider ...
Yes, the project is a class library in the sense that it is a collection of classes, at least one of which extends IExternalApplication or IExternalCommand. Remember that you're not creating a standalone application, but adding functionality to an existing Windows application (Revit). Revit will instantiate the ThisApplication class and then call its .OnStartup() method when the Revit application starts. This shouldn't stop you from adding .xaml or .cs files to the project, though. I can do it using VS Community 2015 using Ctrl-Shift-A.
Hopefully this gets you started - I've been able to implement a WPF UI in Revit without any prior WPF experience, and I'm not even a real programmer, so it's definitely possible. Good Luck!
addendum
If you want to add WPF elements to an existing revit addin, you can follow the instructions here: How can I connect xaml and xaml.cs files
Ultimately I found it easier to migrate my addin code into a template made from a working sample, you may want to try this approach as well.

Where can I find a gallery of all the standard winforms widgets?

I just want a URL to a gallery of widgets such as this one, but for the default WinForms controls that come standard with Visual Studio 2012.
I ran VS and I open the "Toolbox" view and it shows about 150 different widgets. I just want to see a simple picture of each one on a single web pages so I know roughly what they look like.
I tried Google and found this, which is WPF and shows very few pictures.
When you have a WinForm open the Toolbox has an All Controls option - you can open that and take a couple of screenshots.

Custom window for CHM help project

We're developing in WPF and are using custom borderless windows like the new Office 2013 windows. Now we are creating CHM help using RoboHelp.
I'd like to know if there's a way to launch a CHM file, but somehow hook into it so that it loads in a custom window that I specify, rather than the default window. Even better would be some kind of CHM display control that could be embedded in a WPF window, analogous to the way you can embed an HTML browser control in a WPF window. That way I could compile the CHM content with RoboHelp, but display it in our own custom borderless window that's part of our application.
CHM is no longer supported by MS since Vista, so you might want to consider using RoboHelp to generate Webhelp instead, and display that in a browser control as you described. Webhelp also supports context sensitivity via the URL, if that is needed.

WPF forms+ Winforms in MDI

We have an application which is using winforms. Now we want to upgrade it.
We are planning to use some WPF forms and some old winforms. and we also need to use MDI.
From MDIParent we need to open both winforms and WPF forms. And these forms need to be in tile format. I got to know that WPF doesn't support MDI.
Is there any other way to achieve this?
Using AvalonDock, can we display the forms in tiles format also. I know that it display in Dockable format.
why you want to upgrade your application to wpf and still use some of your old winforms and the mdi concept any further?(i dont like mixup both:))
for quick and dirty what about using your winform app and integrate wpf in it - if you want/have to?
EDIT:
if you want your WinForms in Wpf you can use
<WindowsFormsHost />
It should work with Avalon too. Here is an example for WindowsFormsHost.

Image drag and drop in wpf application

I want to drag and drop an image on wpf application form. Can anyone provide me the code and other links for that?
If you want to D&D within a single WPF application; then this code should get you going:
Drag and Drop within WPF
If you want to D&D between WPF applications, or between another non-WPF application you've got some options, but probably the easiest is to use a bitmap transfer (it takes a bit more code, so let me know and I'll publish it).

Resources