WP8 keyboard handling - c#

How to handle page completely going up when clicking on the text box in WP8. (During the time of focus goes to textbox) and Keyboard renders.I want to block header(page frame) going out of screen.

This is a known issue.
You can use something like that https://siphelper.codeplex.com/.
Or write you own code (based on this page) to put the layout down when keyboard is appearing.
When SIP keyboard is rendered, PhoneApplicationFrame.TranslateTransform.Y
is set to specific values (-259 in landscape orientation, -339 in portrait orientation).
To update layout, we’ll just set top margin to the specified value(-s) and
after that Silverlight layout system will fix the issue.
However, this is a common behavior for the platform. Users are familiar with it.

Related

WPF Programmatically Enable TextBox Scrolling/Panning for Tablets

I am working with a WPF application that will be used on Windows tablets. The issue I am having is that I cannot scroll through a large multi-line TextBox on a tablet by pressing and dragging the content. However, it still scrolls on a desktop with a mouse wheel.
This question (Enable swipe scrolling on Textbox control in WPF Scrollviewer) seems to answer the same problem I am having, but I need to do it programmatically. This is what I am doing to set the panning mode of the TextBox:
txtLongText.SetValue(ScrollViewer.PanningModeProperty, PanningMode.None);
Which I can tell is working because the click & drag text selection is now disabled, but the content still does not scroll. I am also setting the panning mode of the outer ScrollViewer as such:
popupScrollView.PanningMode = PanningMode.Both;
The popupScrollView object is then being set as the content inside a Popup.
The only thing I can think of is if there is somewhere else higher up that I need to be setting the panning mode? Any help would be appreciated. Thanks.
i have same problem with touch devices. i have a tricky way to handle this kind of issues
You have to handle touch event manually
i have written some codes to handle touch events manually
when UIElement_OnTouchDown(object sender, TouchEventArgs e) event occurred you can keep position of touched position by eventArgs.GetTouchPoint(this).Position.Y.
after that, you can determine is scroll happened or not by watching the position changes.
here is my sample gist
, i use this approach for same issue with touch devices
I think you require to use three properties to achieve this.
ScrollViewer.PanningMode
ScrollViewer.PanningDeceleration
ScrollViewer.PanningRatio
By default, PanningMode sets to None, but set it to another value will enable touch scrolling.
Another thing you can try is to set ScrollViewer CanContentScroll to true.
While Im not sure there is a viable way to solve that using wpf only, I recommend trying to implement html UI inside your wpf application using DoNetBrowser, link.
Then you can use the textarea control in html, which in default lets you scroll on mobile.
Hope this answer helped you.

UWP XAML NavigationMenu Change behavior

I'm using NavigationView in a UWP project that contains a Frame to load pages.
When the windows is small enough the NavigationView Pane is automatically closed only showing the Icons of the MenuItems, if the Menu is specifically opened (clicking the top button) the menu overlaps the pages inside the frame (this happens after a given threshold, when the Window becomes smaller)
I was trying to maintain this behavior all the time (instead of only when the window is resized to small values), even if the window is maximized or is resized to large values.
isPaneOpen appears to be a read only property that does not work at Run time.
The overlap (rather than pushing the frame to the right) I don't know how to get this NavigationView display all the time...
Any help how to do this?
Thank you.
As your description, it seems you want to maintain the NavigationView always in the Compact mode, you can implement this effect by overriding the widths at which the navigation view changes display modes using the CompactModeThresholdWidth and ExpandedModeThresholdWidth properties.
You can try to configure your NavigationView as the following code,
<NavigationView CompactModeThresholdWidth="280" ExpandedModeThresholdWidth="2000"/>
You can set any CompactModeThresholdWidth property value smaller than the minimum default UWP app window width and the ExpandedModeThresholdWidth property value larger than the maximum window width.
More details, please see the NavigationView display modes topic.

UWP Touch keyboard overlaps status bar

Im devoloping a UWP app and I came across a problem.
In my input page when I tap a textbox the keyboard just "pushes" the UI upwards and this happens.
Normal screen:
Check at the top of the page, you can see the problem:
Does anyone know a fix for this? Thanks!
I think this is default behaviour of the keyboard and can't be changed.
If the keyboard would not push the content upwards, it would overlap the actual TextBox, which you want to fill with text.
If your problem is the statusbar getting overlapped/underlapped with the page-content, you could try to change the color of the statusbar, it seems to be transparent at the moment.
See this.

What is the purpose of Popup in XAML Metro apps?

I needed a modal dialog for my app but it appeared there is nothing like that in XAML Metro app. Someone suggested a popup.
I tried and it appeared that underlying UI still responsive.. so a Popup is not modal.
I thought OK may be its purpose is to be a popup in the center of the screen regardless the other layout and it appeared - not. Popup is bound to a layout as everything else. if it is in a grid it will be placed in row 0 and column 0 not in the center..
So may be I missing something. please help to understand. I cant find any use for it different from what can be achieved by using Grid.
what is the purpose of Popup? how it different from any other content controls?
Differences:
You don't have to put it as a child of another control. Though in such scenarios you might get problems traversing the visual tree and focusing on a TextBox won't shift its contents so the virtual keyboard might cover its contents or its adorner contents might lose alignment to adorned controls not on the Popup.
Its content tree is rendered on top of any other content and (I believe) doesn't get clipped by parent control's Clip regions.
You usually need to set its Width and Height manually when first showing or when parent layout (or size) changes, especially in one of the most common scenarios when you set its Width and Height to the Width and Height of the parent (or the window).
That said - modal dialogs are bad UI and should be avoided. You can simply navigate to another page if you would otherwise want to display a dialog or use other approaches. There's (almost) nothing more annoying than displaying a modal dialog over UI that looks otherwise enabled but doesn't respond to input.
I needed a modal dialog for my app but it appeared there is nothing like that in XAML Metro app. Someone suggested a popup.
Since Windows 8.1, there is actually something similar to a modal dialog that you may want to look into:
It's called Flyouts.
Apparently a modal popup with custom content is missing in Windows 8.1. One possible workaround:
use a Popup control (per se not modal)
make the background semi-transparent
stretch it across the entire screen
place the actual popup content inside that container and leave some space around it
Now, the parent page is visible but dimmed, and it cannot be accessed as the Popup is covering it.

Parent controls lose manipulation features when child controls ManipulationMode is set to other than 'None'

Basically, I have a SemanticZoom control with a GridView inside it, and the GridView has a custom control inside it, but for simplicity, let's assume it's a simple red Border. The problem is that I'm trying to handle the Border's manipulation when scaling (set ManipulationMode to Scale) so that I can know when the user does a pinch out gesture and "Zoom In" into the Border (which is really another page), but by handling the Manipulation, I lose the ability to (1) use the SemanticZoom and (2) Scrolling the grid.
If you have used the Windows 8 photo app, you'll notice that they implement this feature somehow. If you pinch in into an image, the Page will go into SemanticZoom, but if you pinch out it will go into full screen mode. I want similar functionality, but I don't know how to achieve it.
Any ideas?
Thanks in advance.
I will use 2 SemanticZoom controls to achieve Photo App Effect.

Categories

Resources