Use Windows UIAutomation to tap on WPF TextBox - wpf

My WPF Windows Desktop application is with touch support - so when I tap on TextBox the keyboard pops up.
I'm trying to write a test using Windows UIAutomation for my WPF application.
I want to "tap" on TextBox using UIAutomation and check if the screen keyboard actually pops up.
How can I do it? I don't want to use WinAPI for that.
Thank you!

Seems like UIAutomation has no ability to tap/use touch.
We will use WinAPI do to that (already tested, it works). The solution can be found here:
https://github.com/GuOrg/Gu.Wpf.UiAutomation/blob/c0109f39062e254b3eae40275730f0e9f7efce6e/Gu.Wpf.UiAutomation/Input/Touch.cs

Related

How to make Textbox Focus Prompt Keyboard Input

This is my first WPF project and I'm attempting to create an application for my engineers. They will be using a Tablet PC with Windows 8. They execute the application and inspect a machine to verify if it has some issues.
I made this application using winforms but I couldn't get the keyboard input to pop up and let me type in stuff. So I switched to WPF (since I will need to provide a signature capture as well). This is what I was looking for when tapping on the textbox (in red):
I started by creating a textbox just to see if the keyboard layout would pop up. The only way I could pop up the input panel is by using the following code:
Private Sub TextBox1_TouchDown(sender As Object, e As System.Windows.Input.TouchEventArgs) Handles TextBox1.TouchDown
Process.Start("TabTip.exe")
End Sub
There has to be an easier way ... I must be missing something completely. Is there another control I can use to make the keyboard input pop up automatically? Without having to provide code?
Maybe you should use a Custom WPF Control that mimics a keyboard like, WPF Touch Screen Keyboard because working from a managed enviroment like .Net to the nativw Windows API is a bit difficult.
Also have you tried a Windows 8 Metro application I think in there is trasparent to the programmer the use of keyboard.

Is it possible to call a Windows Forms Keyboard in a Silverlight Web Application?

I need a multilingual Keyboard for my Silverlight WebApplication. I have now written it with Windows.Forms and Sendkeys. It works fine.
Now the problem is that I want to call it inside from the Silverlight WebApplication with a Click Function on a Textbox or a button so when its pressed the Keyboard pops up. I thought about running the Windows.Forms Application in the Background and tried to FindWindow() with Silverlight but it did not work at all.
I am not sure about using winform. But, you can use win32 methods (so, I guess Winforms too) in Silverlight 5 using PInvoke

Windows 7 Touch

I want to write a WPF-application with support of touch events.
But, I have a problem. I installed Windows Surface toolkit for Windows Touch, but none of the Manipulation-events (ManipulationStarting, ManipulationDelta and other) for the Grid are not raised when I’m clicking and then moving the mouse over it.
Could anyone tell how to catch manipulation events in WPF for Windows 7 using Windows Surface toolkit's library?
Thanks in advance.
If you use a touch device the Manipulation events will work directly. If you want to use a mouse device to simulate touch, you can use Blake.NUI's MouseTouchDevice to do just that.
Simply add that file or library reference to your project and call
MouseTouchDevice.RegisterEvents(this);
on the constructor of your Window. You can also pass another element as parameter if you want to limit the mouse simulation to a smaller region.

Is there a ChildWindow equivalent on Windows Phone 7? How to do rich modal popups

I'm developing a phone app and need a modal dialog with some "rich" content - a few text boxes and a drop down. OK, not very rich but more than a MessageBox. :>
In regular Silverlight I know there's the ChildWindow control - but can't find the equivalent in Phone 7.
How have other folks done rich popup dialogs on the phone?
Thanks!
Silverlight actually has a control called a Popup. Here's the MSDN documentation.
It's incredibly simple to use (just set IsOpen to true to dispay) and quite effective. The only reason you might use a Panel with manual state control would be is you want precision control over animations etc.
Where I've seen people implement something like this they just have added a panel to the page and made this visible to act as a modal popup.
If you do this, be sure to handle use of the back button correctly.
Actually, there is ChildWindow on Windows Phone 7 in System.Windows.Controls library.
These are some examples:
http://www.c-sharpcorner.com/uploadfile/raj1979/how-to-implement-childwindow-in-windows-phone-7/
http://blog.deepwire.co.uk/?p=434
http://www.31a2ba2a-b718-11dc-8314-0800200c9a66.com/2011/06/how-to-create-childwindow-login-popup.html

How to set Win32 window as owner of WPF window?

I want to use WPF windows in a legacy win32 application.
I'd like to behave them in a similar way, like the WPF window always being displayed on top of the win32 window.
For this I'd like to set the owner of the WPF window to the win32 windows, but I got no idea how to achieve this.
Any help here?
Since the answer is hidden behind some link, here the code that did the trick:
System::Windows::Interop::WindowInteropHelper^ helper = gcnew System::Windows::Interop::WindowInteropHelper(myWpfChildWindow);
helper->Owner = (System::IntPtr)myMainWindowHWND;
This article shows how to get the handles for both as well as how to make the WPF window become a transparent overlay for the win32 window.
http://dedjo.blogspot.com/2007/04/transparent-wpf-control-over-unmanaged.html
This article uses a WindowInteropHelper to accomplish similar functionality.
http://blogs.msdn.com/wpfsdk/archive/2007/04/03/centering-wpf-windows-with-wpf-and-non-wpf-owner-windows.aspx
MSDN page on WindowInteropHelper:
http://msdn.microsoft.com/en-us/library/system.windows.interop.windowinterophelper.aspx
Hope that helps,
Ed
How about SetParent()? I know works when making a WPF window an MDI Child of a Windows Form.

Resources