I will attempt to describe my problem.
I am creating a simple map application that plots the location of my home.
I would like to be able to press a button that LOCKS the screen so the map cannot scroll.
I currently have everything working, the only problem is I cannot figure out how to remove the OnTouch event that currently Pans/Zooms the map. I am using BING API with C#/XAML.
Does anyone know how to prevent the touch events from panning or moving about the map?
You can store the map center and zoom values when the lock button is pressed and then use the view change event to set the maps center and zoom to these values. This will cause the map to lock.
Related
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.
I am making an app with panoramic view where the user can select a color hue, saturation and value from a color wheel and SV graph like this:
http://i.imgur.com/JM1FD1z.jpg
http://i.imgur.com/51ymotz.jpg
The user can either tap or drag a pointer across the square, coordinates determine the values. But when they drag(mousemove), the app will also slide to the next screen.
Is there a way I can disable the slide to next page if the sliding is done within the graph? It should function normally outside the graph area.
Something like a disable panoramic slide function that can be implemented within the graphs mousemove event handler?
Putting the hue wheel and SV-graph on separate pages will dramatically reduce the combined dynamic functionality of the two so I'd prefer them to be on one panoramic page.
This doesn't seem a good use of a panorama. This will lead to "gesture competition" between the touch action on the controls and the panorama itself. The same problem arises if you use a Pivot control.
If you want Hue and SV on the same page, why don't you put them on the same page and allow switching of the mode by a button, say on the app bar?
You can have both controls in the XAML tree and show the one which is active and hide the other. You can do this by changing the Visibility of each control.
I have picture that I should use it as map in my C# form application.
Is there any way that I can put some points or buttons on this picture that when user click on it some things happens.
A thing that is important for me is that I want user can zoom on the map. But if the user zoom on map buttons wouldn't move.
I want locate some click-able points in the map that can be zoomed and moved too.
Thanks.
I am working with map control in my Windows Phone application. After I have set route between two points, map control automaticaly zoom in. How can I implement not zoom in after seting a rote?
I would expect that you can't.
The map control automatically adjusts zoom levels when it pans and moves around and I haven't found a way around this other than keeping track of the original zoom level and resetting it after the control does its thing.
You should just disable the map control, like this:
map1.IsEnabled = false;
I'm attempting to write a small app that will do something similar to what is shown here:
http://www.soccertutor.com/tour/MASTER_SKIN_team.swf
However I've not used WPF/Win Forms very much at all and can't seem to find a control that will be most applicable to the situation. I want to have some sort of grid for the pitch so I can have players, cones, other items snap to certain parts of the grid and I would like the players to be draggable onto the various grid squares.
Thanks very much, I look forward to hearing your recommendations/suggestions!
You don't use controls for something like this. You use objects in your code that represent a visible item on the screen. Periodically you render an update to the screen. You draw the background, then each object. You add mouse hit testing to make the scene interactive to the user. The main game loop calculates new object positions, implements object collision detection and game rules.