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.
Related
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.
I have a custom control. Can I show tooltip where I want and when I want? TooltipService and Tooltip classes don't help me, because don't contain appropriate members. Is there another way to implement custom tooltips?
Note that the ToolTip can be opened programmatically by setting IsOpen, and besides the top/left/bottom/right placement modes which are ideal for touch users, the mouse placement mode can position a tool tip relative to the touch/mouse point. If the provided tooltip placement modes don't suffice for your scenario, use a Popup (ToolTip uses one under the hood).
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.
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.
How can I make a WinForms ListView scroll vertical by MouseWheel?
I'm using C#.
Is it OK if the list scrolls only when it has focus? If so, use the Control.MouseWheel event.
Do you want the list to scroll if it doesn't have focus? Then you need to need to either implement a mouse hook, as described in the other article, or take a look at the Application.AddMessageFilter method. Application.AddMessageFilter gives you a managed version of a mouse hook. You get to preview the messages as they come in. I wrote something about it here.