Open Windows 10 touch keyboard docked in WPF - c#

We started creating a WPF touch application in Windows 8 and recently migrated to Windows 10. One feature we implemented is opening the Windows Keyboard when a TextBox receives focus. In Windows 8, it was possible to dock the keyboard to the bottom by setting the registry setting EdgeTargetDockedState and starting the TabTip process:
string path = #"C:\Program Files\Common Files\Microsoft Shared\ink\TabTip.exe";
var info = new ProcessStartInfo(path);
info.WindowStyle = ProcessWindowStyle.Maximized;
var p = new Process();
p.StartInfo = info;
p.Start();
The Windows 10 keyboard however doesn't seem to have the same dock behavior as in Windows 8. The keyboard now overlays any maximized window which hides the bottom part of any application. Only not-maximized windows are resized to fit the remaining space.
I've checked the following links, but found no solution:
https://superuser.com/questions/951841/windows-10-touch-keyboard-doesnt-dock-or-maximize-at-the-bottom-of-the-screen
http://answers.microsoft.com/en-us/windows/forum/windows_10-desktop/windows-10-touch-keyboard-doesnt-dock/3c253400-568f-4e89-a253-0d7a747b5b63
Can the Windows 10 keyboard be docked programmatically for a maximized window?

I open-sourced my project to automate everything concerning TabTip integration in WPF app.
You can get it on nuget, and after that all you need is a simple config in your apps startup logic:
TabTipAutomation.BindTo<TextBox>();
You can bind TabTip automation logic to any UIElement. Virtual Keyboard will open when any such element will get focus, and it will close when element will lose focus. Not only that, but TabTipAutomation will move UIElement (or Window) into view, so that TabTip will not block focused element.
For more info refer to the project site.
To clarify: If you will be using this package TabTip will not be docked, but your UI will be in view, which i guess is what you wanted to achieve.

Check this article:
http://www.codeproject.com/Tips/1120263/Virtual-Keyboard-TabTip-integration-in-WPF-on-Win
Virtual Keyboard will open when any such element will get focus, and it will close when element will lose focus.

EDIT: In the case when WindowStyle is set to None, please check out my answer here. Also for manually handling touch keyboard appearance events, check out the sample code here.
The answers here are quite old, currently the touch keyboard works just fine when tapping any textbox, even if the window is maximized.
I recommend targeting at least .NET 4.6.2 to get the best support for touch keyboards in Windows 10, due to a bug in WPF that was fixed in that version. Read more here, scroll down to WPF section.
The only thing you'll have to do is design your XAML in a way that your user interface can react properly when the touch keyboard shows up. Usually putting your content inside a ScrollViewer like so should be enough:
<ScrollViewer PanningMode="VerticalOnly"
VerticalScrollBarVisibility="Hidden"
HorizontalScrollBarVisibility="Disabled"
<!--Content here-->
</ScrollViewer>
But for more advanced scenarios, like moving buttons that are at the bottom to above the keyboard, you'll need to write your XAML inside the ScrollViewer more carefully, for example by using grids with dynamic heights.
Hope this helps!

Related

WPF Custom WindowChrome Minimize, Close actions no animation

I am creating a WPF app with a custom window chrome using the <WindowChrome.WindowChrome> tag and properties that go with it. I implemented the Windows commands needed to correct the sizing issue for custom windows, and all of that is working great, however I notice that in standard windows (at least for Windows 10), when you minimize or close a window, it doesn't just disappear, you see a faint animation before the window is either minimized or closed. In my custom window, when I execute either of these actions the window just vanishes, which isn't bad or anything, but if I want to mimic my custom window as closely to the standard as possible, I assume I would need to code that somewhere using something from user32? Has anyone else noticed this before? Is this just how it is for custom windows?
Notes: I am developing on .NET 4.5.2 in C#.
Thanks!
I just ran into this, and this post gave me the necessary clue:
Change the WindowStyle before WindowState is no solution, because of "AllowsTransparency = true".
Indeed, if i use WindowChrome but don't set the WindowStyle to None, the animations work fine. It's only once you use transparency that this breaks. You didn't specify needing that, so maybe this is your solution!

Windows 10 UWP - How to make app dock at window edge and foldout

I'm planning the development of a fairly simple app and have little experience with UWP, some with Winforms. I'd like to make it so that the user can dock the app (similar to the taskbar, but the size of a browser tab) to the edge of the screen and allow it to slide in/out on click or hover. Searches have turned up nothing (maybe I'm not using the right terms) and I've yet to see this functionality on a Windows 10 app.
I'm thinking that I could just force the window to be offscreen or have a 0 width. But I'm not certain how to make a tab appear when that happens. Would I make a second window that is the tab?
All constructive thoughts and ideas are welcome.

AppBarButton in compact mode inside CommandBar

I found in the documentation for CommandBar this description:
The app bar button controls are characterized by an icon and associated label. They have two sizes; normal and compact. By default, the text label is shown. When the IsCompact property is set to true, the text label is hidden. When used in a CommandBar control, the CommandBar sets the IsCompact property automatically as the control is opened and closed.
Am I able to somehow keep IsCompact mode active for AppBarButton also if a CommandBar is opened?
It works if I use AppBar, however, it does not have SecondaryCommands and also I can see in the documentation some kind of recommendation to use CommandBar instead of AppBar for Windows 10 apps.
You should use the AppBar only when you are upgrading a Universal Windows 8 app that uses the AppBar, and need to minimize changes. For new apps in Windows 10, we recommend using the CommandBar control instead.
I was experimenting with Opening and Opened events of CommandBar but I was not too much successful with any solution.
Override the AppBarButton template (fou can find it here: https://msdn.microsoft.com/en-us/library/windows/apps/mt299122.aspx?f=255&MSPPError=-2147217396), and remove the changes in the compact visualstate.
This way they'll always look the same.

TagVisualizer - when active - blocks Textbox touch Keyboard focus inside a ScatterViewItem

I have a TagVisualizer covering the entire screen. Nested inside is a fullscreen ScatterView. Inside one of my ScatterViewItems is UserControl which lists n amount of SurfaceTextBoxs. The UserControl and ScatterViewItems are always visible.
E.g.
<TagVisualizer Panel.ZIndex="1">
<TagVisualizer.Definitions>
...
<TagVisualizer.Definitions>
<ScatterView Panel.ZIndex="2">
<ScatterViewItem />
<ScatterViewItem />
<ScatterViewItem >
<UserControl />
</ScatterViewItem>
...
</ScatterView>
</TagVisualizer>
The problem I have is when there is no tags being recognized on the table the Touch input works and the Keyboard pops up and functions correctly. However when there is a tag on the table being recognized the keyboard no longer focuses on the textblock and wont react to user touch input. I thought layering the content zindex would solve this but I was wrong...
What is frustrating is that my code works with the Surface Input Simulator tools but not on the device itself. (tag and touch tool options, not mouse).
The tags are precisely cutout and do not appear as blobs / finger
touches on the table.
Dragging and dropping of content from
scatterview to librarybars etc all work as intended.
Other buttons and touch elements are all working as intended
The Source for each tag is IsHitTestVisible=false and has no buttons etc (only a Ellipse which shows me where the tag is if being recognised)
Only the
keyboard functionality is not functioning as I thought it was
intended.
I believe the reason behind this is due to that the Tag captures the Mouse context and won't let go and the default Keyboard functionality needs not the touch input but the single mouse event. How would I go about making the Keyboard work on a SurfaceTextBox - Inside a UserControl - when a Tag is being recognized?
I'm new to WPF and this problem is causing me a minor headache...I have looked at the SDK examples and I cannot find a solution for this.. Is there something stupid I am doing or something simple not doing/have missed?
Any help would be appreciative :)
After researching more about the keyboard structure of Surface 2.0 programs and again following the Shopping Cart example you have to use the Surface 2.0 Keyboard, not the Tablet one (the one you can toggle on/off in the control panel). I made the foolish error in thinking that both the keyboards can operate the same... nope.
The Surface 2.0 keyboard accepts touch input and works with TagVisualizers. This is due binding the keyboard to certain SurfaceTextBoxes and it taking in touch input even when the mouse has not clicked on it.
The Tablet windows default keyboard does not work with touch input unless a mouse input has touched it (when there is no other input the last and current active touch input is promoted to a mouse). This keyboard always shows when no over keyboard is specified and it is enabled in the Control Panel. This is tedious to work with TagVisualizers as when there is no mouse/touch input but there is a recognized tag.. this tag will steal the contact and until you take it off.
This problem does not exist with the Surface 2.0 keyboard. When you develop with the Surface 2.0 keyboard the Tablet keyboard will take it's place (annoyingly) until you run your software via the Surface Shell...
To develop your program and see the Surface 2.0 Keyboard you will have to have a development environment for and on a set up for Surface. E.g. develop on a Samsung SUR40 etc
http://msdn.microsoft.com/en-us/library/ff727875.aspx Testing in Windows mode
http://msdn.microsoft.com/en-us/library/ff727840.aspx Testing/debugging for surface
http://msdn.microsoft.com/en-us/library/ff727766.aspx Surface Keyboard
P.s. I believe this is correct... I am still researching on this issue and if I find a way around this Ill update my answer...
Edit:
To extend this answer.. You should code the application to use the Surface Shell, via the launcher you should either launch your application from the selection of available applications and / or set the shell to one application mode if you're programming for a store environment.

Aero border and other controls in a TrayIcon menu

I'm writing a system tray app for Windows (with much info gleaned from this thread). I have the ContextMenu working - you can right click and execute functions that way.
I want to have a modern, rich interface pop up on a left click, however, much like most of the built in Windows 7 (and possibly Vista) tray icons have. By this I refer to the Aero lining, and apparent ability to add seemingly arbitrary controls (e.g. volume slider, network chooser).
I'm not really sure where to start. Is it a matter of creating a "normal" window and restricting it heavily? If so, how? (If it comes down to Windows Forms vs. WPF, the latter is preferable).
For what it's worth, you can display anything you like when you receive the mouse click on your notification icon. Usually it's a pop-up menu, but you could show a window instead.

Categories