I am trying to create a multitouch application.
I have the hardware which will allow me to do this. On the software side I want to be able to have WPF textboxes, WPF web browsers, multiple focuses, multiple keyboards and multiple users at the same time.
From what I've seen, I can't be focused on two controls at the same time.
What is the Microsoft MultiTouch approach for this kind of job ?
The OS limitations are what they are (and don't appear to change in Win8): only one hWnd at a time can have focus.
Since you are using WPF though, everything within your application (with the exception of the WebBrowser control ActiveX widgets you may be using) is rendered within one big hWnd.
WPF 4 introduced native support for multitouch, including multi-touch capture. The APIs for this are many but pretty intuitive so I'll just say this... go to http://msdn.microsoft.com/en-us/library/ms590078.aspx and search within the page for all of the members with "Touch" in their name.
The catch however is that the controls shipping with WPF 4 don't work with the touch input events... you'll only be able to interact with one of those controls at a time. To take advantage of the multi-touch capture APIs, you'll have to create controls that are designed with it in mind. Fortunately, the Surface team at Microsoft has you covered on that... the "Surface 2.0 SDK" includes a suite of controls (usable on any Win7 machine, not just for Surface) that were built with this stuff in mind.
To create application with MultiTouch UI, use MultiTouch Framework in .Net
Go to http://multitouchvista.codeplex.com/
Related
From MSDN article I found out that WinForm controls can be hosted in a WPF application using HwndHost.
Also, from other internet resources, I found that WPF is rendered using DirectX and WinForm is rendered using GDI+.
My question is, what renders a WinForm control when the WinForm control is drawn in a WPF application; DirectX, GDI+, or both?
I have very little experience with both technologies and making baby steps.
Thank you
You are incorrect about requiring a HwndHost to display a Windows Forms control in a WPF Application. The article that you were reading is for Win32 Interoperation, not for Windows Forms. To use a Windows Forms control in a WPF Application, you should use the WindowsFormsHost Class.
As for what will render the Windows Forms control, you need to understand something. WPF uses a totally different graphics system to Windows Forms. From the WPF Graphics Rendering Overview page on MSDN:
One of the keys to understanding the role of the Visual object is to understand the difference between immediate mode and retained mode graphics systems. A standard Win32 application based on GDI or GDI+ uses an immediate mode graphics system. This means that the application is responsible for repainting the portion of the client area that is invalidated, due to an action such as a window being resized, or an object changing its visual appearance.
In contrast, WPF uses a retained mode system. This means application objects that have a visual appearance define a set of serialized drawing data. Once the drawing data is defined, the system is responsible thereafter for responding to all repaint requests for rendering the application objects. Even at run time, you can modify or create application objects, and still rely on the system for responding to paint requests. The power in a retained mode graphics system is that drawing information is always persisted in a serialized state by the application, but rendering responsibility left to the system.
Therefore in general, the WPF Rendering system will render the WindowsFormsHost, although you may find that Windows Forms does actually perform some rendering of its own on the Windows Forms control.
You need to understand WPF and Win32 Interoperation, it show how controls are plotted.
On the other hand Technology Regions Overview explains the relationship between Wind32, WPF and DirectX.
Hope it will make you more clear about this..!!!
My team is diving headfirst into a new project and we are taking the opportunity to bring ourselves up to date with Scrum methodology, new technology etc. Part of this involves trying to automate our QA process, using both Microsoft Test Manager and VS2010 Coded UI tests.
However, we are having problems getting the automated test playback to work with our currently-selected WPF control library, the DevExpress XPF suite. We've been using DevExpress for their WinForms and ASP.NET controls for years now, but this is our first experience with their WPF controls, and with automated UI tests, and the two don't seem to work well together.
In particular, trying to play back a recorded test that interacts with a grid control never works right, and even on simple controls the playback seems to get confused over which editor it should be interacting with. In the action recordings our test lead is generating from MTM I see a lot of this:
Type '5236' in 'PART_Editor' text box
Type '253' in 'PART_Editor' text box
And even worse, inside of the grids:
Click 'FooterPanel' pane
Last action on list item was not recorded because the control does not have any good identification property.
Click 'FooterPanel' pane
Click 'Item: CashEntry, Column ...' custom control
Move 'Item: CashEntry, Column ...' custom control from (141, 10) to 'Item: CashEntry, Column ...' custom control (5, 11)
Type '{NumPad8}{Down}{NumPad5}{NumPad0}{Up}{Down}{Down}' in 'CashEntry' window
Now, I have seen plenty of chatter on DevX's forums about their WinForms controls not supporting MSAA well enough for coded UI tests to work, but I thought that WPF used a different mechanism for automated UI testing that was supposed to work better. So, my questions are:
Is there a way to get the DevX XPF controls to work better with coded/automated UI tests?
If not, is there an alternative XPF control suite that is known to work well with coded/automated UI tests?
I'm specifically interested in a grid-like component with sorting, grouping, etc., a navbar-like component, and custom editors (dates, numbers, etc), all which support a unified system-wide theming.
(Also, if this type of thing is easy enough to do using just native WPF controls and styles, that would be helpful to know as well.)
EDIT: Since there appears to be no WPF control suite that actually works with MTM, we're being forced to use two separate testing tools at the sam time. Per several of the answers here, we're strongly leaning towards TestComplete. Hopefully the situation improves soon.
Don't have much idea about control suite supporting this but We had analyzed a test suite in past which supports objects based automated testing for WPF. Have a look at TestComplete (although it's not free)
Here is an excerpt from there site mentioning control support they provide -
WPF Control Support TestComplete offers rich support for WPF (XAML)
controls and robust automated UI testing of WPF applications.
TestComplete’s high-level test actions, such as item selection or cell
data input, are object-aware rather than coordinate-aware and thus are
more stable and resistant to the UI changes when performing WPF
testing. Flexible object mapping schemes allow testers to map custom
or derived WPF controls to standard types to simplify UI
manipulations. Support for custom WPF controls can also be added
using the TestComplete SDK.
http://smartbear.com/products/qa-tools/automated-testing/testing-wpf-apps/
I've heard very good things about WiPFlash.
In one of our projects we've used Infragistics WPF controls and TestComplete works with it.
Our QS Team also use TestComplete
I found a free utility that is independent of UI libraries.
PROJECT SIKULI
Sikuli is a visual technology to automate and test graphical user
interfaces (GUI) using images (screenshots). Sikuli includes Sikuli
Script, a visual scripting API for Jython, and Sikuli IDE, an
integrated development environment for writing visual scripts with
screenshots easily. Sikuli Script automates anything you see on the
screen without internal API's support. You can programmatically
control a web page, a Windows/Linux/Mac OS X desktop application, or
even an iphone or android application running in a simulator or via
VNC.
You can also use the VS internal UI test framework: Create a Coded UI Test.
just found this thread...
we had the same problem using DevExpress components,
which weren't findable on playback of CUIT.
But especially with Sikuli script the problem is solveable...at least.
Record test with MS Test Manager
Playback test, to find unreproduceble step
Create Sikuli sequence to 'step over'
Include created Sikuli script at appropriate position in CUIT and start again at Step 2
It really takes time to create tests this way, but at least its possible.
What are my options for interacting with a COM control from silverlight?
In my particular project, I have a legacy ActiveX authentication control which I would like to leverage in my silverlight application. Without too many boring details, the control takes a couple of parameters, prompts the user for credentials or tokens, and raises events. I need to set the parameters from my control, and somehow get the events' data to my control.
Furthermore, I would like to get the UI to seem as homogeneous as possible.
What are the best ways of doing this?
Silverlight 4 Beta was announced to have COM Interop for Trusted Applications.
More information on the Tim Heuer blog: http://timheuer.com/blog/archive/2009/11/18/whats-new-in-silverlight-4-complete-guide-new-features.aspx#com
IIRC, Silverlight doesn't provide any way work with COM directly - there's no P/Invoke nor COM Interop - and the sandbox wouldn't allow you to do that in any case. However, you could host ActiveX control in the browser alongside your Silverlight application (which obviously restricts this to IE only), and then write some in-browser JavaScript glue to work with it - JavaScript can interact with both ActiveX and Silverlight.
I don't think you can reasonably host an ActiveX control inside your Silverlight application, however. The closest you can do is as described above, but position ActiveX control (in browser DOM) on top if Silverlight canvas in the right spot, so it looks like a single UI. Not sure if this will not produce any rendering artifacts, however.
I have a simple WinForms type application (main form, couple of sub-forms, minimize to system tray with notifications showing here).
I was going to move to WPF however I'm hearing some people say go silverlight (out of browser).
Question - Which way should I go for a simple desktop winforms type app? WPF or Silverlight?
Tks
It depends on what features you need. If you must minimize to the tray, it'll be easier in WPF. Silverlight, however, supports notification toast for notifications. It's not trayed, but it still works well.
Also note that Silverlight doesn't have floating child windows, so if you need them, you'll need to go WPF. You can get close analogs with the ChildWindow control, but they must stay within the bounds of the Silverlight application as they are ui elements, not real hwnd windows.
Silverlight 4 lets you do almost anything you need using COM automation. However, resist using that for major functionality. If you're targeting just Windows, do a click-once WPF application, preferably WPF4 if your timeline permits it. Reserve COM automation for OS "light-up" functionality in otherwise cross-platform applications.
Ease of application deployment is one big factor which Silverlight has going for it.
Depending upon the requirements and audience for the program, WPF or Silverlight will have advantages.
If you are able to run a setup on the target machines then WPF will be an option. If you want to launch from a webpage then Silverlight is the way to go.
if it's an internal app sounds likes WPF + ClickOnce is possibly the better choice. Unless you have (for example) sales people on the road with diff browsers, OS's etc then an installable SL app that talks to a (WCF) service might be a bet
I just installed visio, and the installer almost seemed like it was built in flash.
The buttons kinda glowed when I hovered over them, and when I clicked on 'continue' the form phased out in a cool way.
I'm assuming it was built in WPF.
Anyhow, so are WPF more flash-like (visually speaking).
Do they have new properties where you can make forms phase out nicely/smoothly compared to winforms?
Disclaimer: I work for Microsoft. However, I don't work on Visio, WPF, CLR or Silverlight team. So, the following is my personal take on these technologies. If you want to quote me, don't do it implying it's the official Microsoft position. :-))
Update: Anything I say below about Flash/Flex/AIR might be wrong, as I have not worked with these technologies and what I know about them is based on what I read on the intertubes. :-) If you notice anything wrong, just shout in the comment and I'll correct it.
To the best of my knowledge, the Visio installer is not built with WPF. It's all unmanaged code; it's just people took a lot of care to make it really polished.
WPF is the new UI platform for building standalone applications for the Windows OS. It supports a declarative UI language - XAML, and related CLR types to program against. WPF is a different platform than WinForms, although it is possible to build applications that mix UI built with both. WPF supports a lot of things that WinForms does not, like bitmap effects, animations, control styling and so on and exposes them both in XAML or through code. Also, WPF relies heavily on vector graphics, as opposed to the pixel graphics in WinForms. In short, WPF is quite powerfull and allows building very snazzy UI. (Don't take my word for it, though, as I am biased; go check around for what people are saying about it or buiding with it. :-))
WPF and WinForms do not compete with Flash/Flex. WPF and WinForms are both UI frameworks for building standalone client applications. As far as I know, Flash/Flex are frameworks for building rich internet applications - RIA (though lately people started interpreting this abbreviation as rich interactive applications).
Adobe did come up with AIR about half a year (or maybe a year) ago, which allows building standalone client applications, so you could say that Adobe is trying to position Flash/Flex/AIR to compete with WPF. Of course, that's my take on it and I doubt Adobe's official positiong is anything like that.
If you want to compare particular MS technnologies with Flash/Flex, take a look at Silverlight - it's the MS RIA platform.
Silverlight is related to WPF in the sense that they share XAML and the corresponding CLR types. Silverlight supports only a subset of what WPF offers, though, as it is not targeting Windows OS only and thus is limited by the fact that it has to be portable.
Quick update to reflect the changes in the year since I've written the answer :-)
With Silverlight 3 shipped, SL and WPF are getting even closer and sharing bigger set of supported features. In addition, most of the new XAML controls are built for platform at the same time. Thus, SL/WPF are getting to a point of singularity...
Also, SL 3 supports out-of-browser applications. In that sense, SL is not only starting to compete with Flash/Flex, but it is also encroaching on AIR's turf.
And no, I still don't work on the WPF or Silverlight team. :-)
WPF is being used as a replacement for WinForms, and as a competitor to Flash in the form of Silverlight. WPF consists of an entirely new object model that sits on top of DirectX (at least the desktop version). You can create WPF windows, controls, etc, entirely using C# or another .Net language just like you can render WinForms. However, Microsoft has also created a markup language called XAML (eXensible Application Markup Language). Nodes in an XAML document (XML) map to objects in a similar fashion to the way ASP.Net maps to web controls. XAML typically exists in a .Net project alongside a code-behind style C# file (or VB.Net or whatever). The C# file interacts with the objects generated by the XAML. This is fairly consistent with the "graphics via markup, logic via code" model that Microsoft and others are pushing.
One of the overlooked features when discussing WPF is the completely awesome data-binding that Microsoft wrote for WPF. The new data binding framework is a quantum leap beyond Windows Forms 2.0 data-binding. Microsoft added a couple of new interfaces that make it much easier to make an object or collection emit data-biding events properly. They also provided a very rich set of data-binding classes. You can bind anything to just about anything else. You can bind one-way data to control, control to data, two-way control to data and back, control to control, etc.
Back on the graphics side of the house, WPF makes it fairly easy to make an existing control look like anything. WP lets you compose your own template for what a class of buttons should look like, or one button, or all buttons. Or radio buttons. Or labels. You get my drift. Imagine if CSS included the ability to define what an input button would look like using other HTML controls.
They also provide a number of layout controls. You can continue to use exact positioning like in WinForms, or you can leverage of variety of techniques to make your window act more like a web page that grows and shrinks with resizing, etc.
The downsides: It is too easy to create spectacular effects that crawl on slower machines. Some of the graphics do not take advantage of hardware of graphics cards, though Microsoft has incrementally improved support for this. I believe when 3.0 first came out drop shadows were rendered purely using software. I think 3.5 or 3.5 SP1 changed it so that WPF would utilize graphics hardware for the task. Microsoft has said they will continue to enhance WPF in this fashion.
WPF is .Net 3.0 and above, which runs on XP SP2, Vista, and Servers 03 & 08. So don't plan on deploying WPF to a customer with Win2k desktops.
Summary: If you are doing desktop programming in .Net, you should be doing it in WPF unless you are targeting Win2k. You can avoid the downsides of WPF, and there are many upsides. Microsoft will probably throw away WinForms in some future release, or at very least you will stop seeing new features, etc.
As far as Silverlight goes, the betas for SL 2.0 look good. I think that Silverlight will require some wide-spread adoption. Microsoft has already tried to get this going. The NBC Olypmics site used Silverlight, and Major League Baseball uses it for its MLB.tv product. As soon as Silverlight gets a good install base I think you will see the Microsoft side of the development world starting swinging away from Flash and to Silverlight.
Edit after using Silverlight 3 and MVVM:
I have moved away from WPF and am doing a lot of Silverlight 3 development. But I think my comments here will still apply to the WPF developer.
I have been using the MVVM pattern in my app (think MVC with a twist). The Microsoft Patterns and Practices team has released a set of libraries known as Prism that supports various aspects of MVVM. There are WPF and Silverlight versions. Take a look at MVVM and Prism if you are going to be doing WPF or Silverlight development.
You can do a lot of flash w/ Winforms, or with custom components. But if you want out-of-the-box bang-whizz availability, WPF is the way to go.
Yeah, I think the intention is to be flash-like, it seems to me that MS has set its sights on taking down Adobe.
The way I see it: WPF is to Flash as WinForms is to Flex. WPF has more emphasis on vectors and states than on programming.